This repository has been archived by the owner on Feb 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
serverless.yml
117 lines (111 loc) · 3.75 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
108
109
110
111
112
113
114
115
116
117
service: aqts-ts-type-router
provider:
name: aws
rolePermissionsBoundary:
Fn::Sub:
- "arn:aws:iam::${accountId}:policy/csr-Developer-Permissions-Boundary"
- accountId:
Ref: "AWS::AccountId"
region: ${opt:region, 'us-west-2'}
stage: ${opt:stage, 'TEST'}
runtime: java11
memorySize: 384
timeout: 60
logRetentionInDays: 90
vpc: ${self:custom.vpc}
deploymentBucket:
name: ${opt:bucket, iow-cloud-applications}
stackTags:
"wma:project_id": "aqtscapture"
"wma:subSystem": "aqtscapture"
"wma:application_id": "AQTS Time Series Type Router"
"wma:contact": "Jim Kreft jkreft@usgs.gov"
"wma:environment": ${self:provider.stage}
"wma:taggingVersion": ${opt:taggingVersion}
"wma:costCenter": TBD
"wma:organization": IOW
"displayName": "TS Type Router"
commitIdentifier: ${git:sha1}
custom:
prune:
automatic: true
number: 3
exportGitVariables: false
vpc:
securityGroupIds: ${ssm:/iow/retriever-capture/${self:provider.stage}/securityGroupIds~split}
subnetIds: ${ssm:/iow/aws/vpc/${self:provider.stage}/subnetIds~split}
db:
connectInfo: ${ssm:/aws/reference/secretsmanager/NWCAPTURE-DB-${self:provider.stage}~true}
esLogs:
endpoint: ${ssm:/iow/aws/vpc/${self:provider.stage}/elasticsearchEndpoint}
index: ${self:service}
retentionInDays: 90
filterPattern: '?Exception ?ERROR ?WARN'
functions:
determineRoute:
handler: gov.usgs.wma.waterdata.DetermineRouteHandler
role:
Fn::Sub:
- arn:aws:iam::${accountId}:role/csr-Lambda-Role
- accountId:
Ref: AWS::AccountId
reservedConcurrency: 35
environment:
FUNCTION_NAME: determineRoute
AQTS_DATABASE_ADDRESS: ${self:custom.db.connectInfo.DATABASE_ADDRESS}
AQTS_DATABASE_PORT: ${self:custom.db.connectInfo.DATABASE_PORT}
AQTS_SCHEMA_NAME: ${self:custom.db.connectInfo.SCHEMA_NAME}
AQTS_SCHEMA_OWNER_USERNAME: ${self:custom.db.connectInfo.SCHEMA_OWNER_USERNAME}
AQTS_DATABASE_NAME: ${self:custom.db.connectInfo.DATABASE_NAME}
AQTS_SCHEMA_OWNER_PASSWORD: ${self:custom.db.connectInfo.SCHEMA_OWNER_PASSWORD}
AWS_DEPLOYMENT_REGION: ${self:provider.region}
ROOT_LOG_LEVEL: INFO
resources:
Resources:
snsTopic:
Type: AWS::SNS::Topic
Properties:
DisplayName: ${self:service}-${self:provider.stage}-topic
TopicName: ${self:service}-${self:provider.stage}-topic
concurrencyAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmName: ${self:service}-${self:provider.stage}-concurrency-alarm
AlarmDescription: Notify when concurrency exceeds the specified threshold
Namespace: 'AWS/Lambda'
Dimensions:
- Name: FunctionName
Value:
Ref: DetermineRouteLambdaFunction
MetricName: ConcurrentExecutions
Statistic: Maximum
ComparisonOperator: GreaterThanOrEqualToThreshold
Threshold: 150
Period: 60
EvaluationPeriods: 1
AlarmActions:
- Ref: snsTopic
errorAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmName: ${self:service}-${self:provider.stage}-error-alarm
AlarmDescription: Notify when number of errors exceeds the specified threshold
Namespace: 'AWS/Lambda'
Dimensions:
- Name: FunctionName
Value:
Ref: DetermineRouteLambdaFunction
MetricName: Errors
Statistic: Sum
ComparisonOperator: GreaterThanOrEqualToThreshold
Threshold: 10
Period: 60
EvaluationPeriods: 1
AlarmActions:
- Ref: snsTopic
plugins:
- serverless-plugin-git-variables
- serverless-es-logs
- serverless-prune-plugin
package:
artifact: aqts-ts-type-router-aws.jar