This repository has been archived by the owner on Jan 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
serverless.yml
125 lines (119 loc) · 4.54 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
118
119
120
121
122
123
124
125
service: aqts-capture-discrete-loader
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: 784
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 Capture Discrete Ground Water Loader"
"wma:contact": "Jim Kreft [email protected]"
"wma:environment": ${self:provider.stage}
"wma:taggingVersion": ${opt:taggingVersion}
"wma:costCenter": TBD
"wma:organization": IOW
"displayName": "Discrete Loader"
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}
transformDb:
connectInfo: ${ssm:/aws/reference/secretsmanager/NWCAPTURE-DB-${self:provider.stage}~true}
observationDb:
connectInfo: ${ssm:/aws/reference/secretsmanager/WQP-EXTERNAL-${self:provider.stage}~true}
esLogs:
endpoint: ${ssm:/iow/aws/vpc/${self:provider.stage}/elasticsearchEndpoint}
index: ${self:service}
retentionInDays: 90
filterPattern: '?Exception ?ERROR ?WARN'
functions:
loadDiscrete:
handler: gov.usgs.wma.waterdata.LoadDiscreteGroundWaterHandler
role:
Fn::Sub:
- arn:aws:iam::${accountId}:role/csr-Lambda-Role
- accountId:
Ref: AWS::AccountId
reservedConcurrency: 35
environment:
FUNCTION_NAME: loadDiscrete
AWS_DEPLOYMENT_REGION: ${self:provider.region}
TRANSFORM_DATABASE_ADDRESS: ${self:custom.transformDb.connectInfo.DATABASE_ADDRESS}
TRANSFORM_DATABASE_PORT: ${self:custom.transformDb.connectInfo.DATABASE_PORT}
TRANSFORM_DATABASE_NAME: ${self:custom.transformDb.connectInfo.DATABASE_NAME}
TRANSFORM_SCHEMA_NAME: ${self:custom.transformDb.connectInfo.SCHEMA_NAME}
TRANSFORM_SCHEMA_OWNER_USERNAME: ${self:custom.transformDb.connectInfo.SCHEMA_OWNER_USERNAME}
TRANSFORM_SCHEMA_OWNER_PASSWORD: ${self:custom.transformDb.connectInfo.SCHEMA_OWNER_PASSWORD}
OBSERVATION_DATABASE_ADDRESS: ${self:custom.observationDb.connectInfo.DATABASE_ADDRESS}
OBSERVATION_DATABASE_PORT: ${self:custom.observationDb.connectInfo.DATABASE_PORT}
OBSERVATION_DATABASE_NAME: ${self:custom.observationDb.connectInfo.DATABASE_NAME}
OBSERVATION_SCHEMA_NAME: ${self:custom.observationDb.connectInfo.NWIS_SCHEMA_NAME}
OBSERVATION_SCHEMA_OWNER_USERNAME: ${self:custom.observationDb.connectInfo.NWIS_SCHEMA_OWNER_USERNAME}
OBSERVATION_SCHEMA_OWNER_PASSWORD: ${self:custom.observationDb.connectInfo.NWIS_SCHEMA_OWNER_PASSWORD}
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: LoadDiscreteLambdaFunction
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: LoadDiscreteLambdaFunction
MetricName: Errors
Statistic: Sum
ComparisonOperator: GreaterThanOrEqualToThreshold
Threshold: 10
Period: 60
EvaluationPeriods: 1
AlarmActions:
- Ref: snsTopic
plugins:
- serverless-plugin-git-variables
- serverless-prune-plugin
- serverless-es-logs
package:
artifact: aqts-capture-discrete-loader-aws.jar