-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsam.yaml
More file actions
48 lines (42 loc) · 1.34 KB
/
sam.yaml
File metadata and controls
48 lines (42 loc) · 1.34 KB
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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
eks-lambda-drainer
SAM Template for eks-lambda-drainer
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 30
Resources:
MyFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
CodeUri: ./main.zip
Handler: main
Runtime: go1.x
Policies:
- AWSLambdaBasicExecutionRole # Managed Policy
- Version: '2012-10-17' # Policy Document
Statement:
- Effect: Allow
Action:
- ec2:DescribeInstances
- ec2:DescribeTags
- eks:DescribeCluster
Resource: '*'
Events:
CWE:
Type: CloudWatchEvent
Properties:
Pattern:
source:
- aws.ec2
detail-type:
- "EC2 Spot Instance Interruption Warning"
Outputs:
MyFunction:
Description: "Lambda function Arn"
Value: !GetAtt MyFunction.Arn
MyFunctionIamRole:
Description: "Lambda function IAM role Arn"
Value: !GetAtt MyFunctionRole.Arn