-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsam.yaml
31 lines (29 loc) · 898 Bytes
/
sam.yaml
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
Transform: AWS::Serverless-2016-10-31
Description: Spot Drainer - drain spot ECS instances before interruption
Resources:
spotDrainer:
Type: AWS::Serverless::Function
Properties:
FunctionName: spot-drainer
Description: "remember to drain your spot fleet"
Handler: main
Runtime: go1.x
Timeout: 20
Policies:
- Statement:
- Effect: "Allow"
Action:
- "ecs:DescribeContainerInstances"
- "ecs:ListClusters"
- "ecs:ListContainerInstances"
- "ecs:UpdateContainerInstancesState"
Resource: "*"
CodeUri: ./source/handler.zip
Events:
SpotInterruptionWarning:
Type: CloudWatchEvent
Properties:
Pattern:
source: ["aws.ec2"]
detail-type: ["EC2 Spot Instance Interruption Warning"]
# eof