-
Notifications
You must be signed in to change notification settings - Fork 2
/
serverless.yml
55 lines (52 loc) · 1.41 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
service: ecs-events
provider:
name: aws
runtime: nodejs8.10
iamRoleStatements:
- Effect: "Allow"
Action:
- "sns:publish"
Resource:
- Ref: ECSStateChangeTopic
functions:
state-change:
handler: state-change/index.handler
environment:
TOPIC_ARN:
Ref: ECSStateChangeTopic
MODE: errors # possible other values are 'all' and 'success'
events:
- cloudwatchEvent:
event:
source:
- aws.ecs
detail-type:
- ECS Task State Change
detail:
# clusterArn:
# - arn:aws:ecs:eu-west-1:000000000000:cluster/example-cluster-arn
lastStatus:
- STOPPED
stoppedReason:
- Essential container in task exited
# - Task stopped by user
resources:
Outputs:
ECSStateChangeTopic:
Description: ECS State Change Topic ARN
Value:
Ref: ECSStateChangeTopic
Resources:
ECSStateChangeTopic:
Type: AWS::SNS::Topic
Properties:
DisplayName: ECS State Change
TopicName: ECSStateChangeTopic
# # Subscribe to SNS topic -> remove #s to enable resource
# ECSStateChangeSubscription:
# Type: AWS::SNS::Subscription
# Properties:
# Endpoint: [email protected]
# Protocol: email
# TopicArn:
# Ref: ECSStateChangeTopic