-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
107 lines (96 loc) · 2.94 KB
/
serverless.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
frameworkVersion: "3"
service: trade-tariff-lambdas-fpo-search
plugins:
- serverless-domain-manager
provider:
name: aws
region: eu-west-2
runtime: provided
stage: ${env:STAGE}
timeout: 29
memorySize: 3072
environment:
SENTRY_DSN: ${env:SENTRY_DSN}
SENTRY_ENVIRONMENT: ${env:STAGE}
deploymentBucket:
name: "trade-tariff-lambda-deployment-${aws:accountId}"
ecr:
images:
fpo-search:
uri: "${ssm:/${sls:stage}/FPO_SEARCH_ECR_URL}:${env:DOCKER_TAG}"
stackTags:
customer: "fpo"
tags:
customer: "fpo"
apiGateway:
usagePlan:
- apiStages:
- api: ${self:service}-${env:STAGE}
stage: ${env:STAGE}
functions:
fpo_search:
provisionedConcurrency: ${param:provisioned_concurrency}
image: fpo-search
events:
- http:
path: /fpo-code-search
method: post
private: true
- http:
path: /healthcheck
method: get
private: false
custom:
customDomain:
domainName: ${param:custom_domain}
stage: ${env:STAGE}
basePath: ""
certificateName: ${param:certificate_domain}
createRoute53Record: true
createRoute53IPv6Record: true
endpointType: "regional"
securityPolicy: tls_1_2
apiType: rest
autoDomain: true
resources:
Resources:
# AWS/Lambda Errors are triggered for:
#
# - Unhandled exceptions thrown by the Lambda function.
# - Timeouts (when your function execution exceeds the configured timeout).
# - Out of memory errors (when your function uses more memory than allocated).
# - Permissions or configuration errors that prevent a function from running.
ErrorAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmDescription: "Alarm if FPO search function errors exceed a threshold"
Namespace: "AWS/Lambda"
MetricName: "Errors"
Dimensions:
- Name: "FunctionName"
Value: ${self:service}-${env:STAGE}-fpo_search
Statistic: Sum
Period: 300 # 5 minutes
EvaluationPeriods: 1
Threshold: 1
ComparisonOperator: GreaterThanOrEqualToThreshold
AlarmActions:
- arn:aws:sns:${self:provider.region}:${aws:accountId}:slack-topic
TreatMissingData: notBreaching
DurationAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmDescription: "Alarm when FPO search function execution duration exceeds threshold"
Namespace: "AWS/Lambda"
MetricName: "Duration"
Dimensions:
- Name: "FunctionName"
Value: ${self:service}-${env:STAGE}-fpo_search
Statistic: Average
Period: 300 # 5 minutes
EvaluationPeriods: 1
Threshold: 50000 # 50 seconds for a cold start of a lambda
ComparisonOperator: GreaterThanOrEqualToThreshold
AlarmActions:
- arn:aws:sns:${self:provider.region}:${aws:accountId}:slack-topic
TreatMissingData: notBreaching