-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
63 lines (59 loc) · 1.38 KB
/
template.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
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
---
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
ec2-ctrl
Parameters:
NameTag:
Type: String
Default: ""
Description: ""
Webhook:
Type: String
Default: ""
Description: ""
Channel:
Type: String
Default: ""
Description: ""
Globals:
Function:
Timeout: 60
Resources:
LambdaFunction:
Type: AWS::Serverless::Function
Properties:
Description: "(Daily) Start/Stop EC2 instances."
CodeUri: build/
Handler: handler
Runtime: go1.x
Tracing: PassThrough
Policies:
- AWSLambdaBasicExecutionRole
- Version: "2012-10-17"
Statement:
- Effect: "Allow"
Action:
- "ec2:DescribeInstances"
- "ec2:StartInstances"
- "ec2:StopInstances"
Resource:
- "*"
Events:
ScheduledEvent:
Type: Schedule
Properties:
Description: "ec2-ctrl events."
Enabled: True
Schedule: "cron(0 0,12 ? * MON-FRI *)"
Environment:
Variables:
NameTag: !Ref NameTag
Webhook: !Ref Webhook
Channel: !Ref Channel
TZ: "Asia/Tokyo"
LogGroup:
Type: AWS::Logs::LogGroup
Properties:
LogGroupName: !Sub /aws/lambda/${LambdaFunction}
RetentionInDays: 7