-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.yaml
More file actions
66 lines (62 loc) · 1.83 KB
/
Copy pathtemplate.yaml
File metadata and controls
66 lines (62 loc) · 1.83 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
packer-janitor
Sample SAM Template for packer-janitor
Globals:
Function:
Timeout: 10
Resources:
PackerJanitorFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: lambda/
Handler: main.lambda_handler
Runtime: python3.9
Role: !GetAtt PackerJanitorIamRole.Arn
Events:
CWSchedule:
Type: Schedule
Properties:
Schedule: "cron(0 0 * * ? *)"
Name: PackerJanitorSchedule
Description: packer janitor schedule
Enabled: true
Environment:
Variables:
SLACK_WEBHOOK_URL: VALUE
PackerJanitorIamRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: "Allow"
Action: "sts:AssumeRole"
Principal:
Service: lambda.amazonaws.com
Policies:
- PolicyName: "packer-janitor-policy"
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: "Allow"
Action:
- "ec2:DeleteKeyPair"
- "ec2:DeleteSecurityGroup"
- "ec2:DescribeInstances"
- "ec2:DescribeKeyPairs"
- "ec2:DescribeSecurityGroups"
- "ec2:TerminateInstances"
- "iam:ListAccountAliases"
Resource: "*"
- Effect: "Allow"
Action:
- "logs:CreateLogGroup"
- "logs:CreateLogStream"
- "logs:PutLogEvents"
Resource: "*"
Outputs:
PackerJanitorFunction:
Description: "First Lambda Function ARN"
Value: !GetAtt PackerJanitorFunction.Arn