-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathserverless.yml
51 lines (46 loc) · 1.22 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
service: ${env:SERVICE_NAME}
resources:
Description: Lambda to remove CloudWatch Alarms when an EC2 instance is terminated
Outputs:
RemoveCloudWatchAlarmsArn:
Description: RemoveCloudWatchAlarms ARN
Value:
'Fn::GetAtt': [ RemoveCloudWatchAlarmsLambdaFunction, Arn ]
Export:
Name: '${self:service}:${self:provider.stage}:RemoveCloudWatchAlarmsArn'
provider:
name: aws
stage: production
runtime: nodejs14.x
region: us-west-2
timeout: 30
memorySize: 1024
tracing: true
iamRoleStatements:
- Effect: "Allow"
Action:
- "cloudwatch:DescribeAlarms"
- "cloudwatch:DeleteAlarms"
- "cloudwatch:SetAlarmState"
Resource:
- "*"
- Effect: "Allow" # xray permissions (required)
Action:
- "xray:PutTraceSegments"
- "xray:PutTelemetryRecords"
Resource:
- "*"
plugins:
- serverless-plugin-tracing
package:
artifact: ${env:ARTIFACT_PATH}
functions:
RemoveCloudWatchAlarms:
handler: ${env:BUNDLE_NAME}.removeCloudWatchAlarms
events:
- cloudwatchEvent:
event:
source:
- "aws.autoscaling"
detail-type:
- "EC2 Instance Terminate Successful"