-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserverless.yml
More file actions
39 lines (39 loc) · 1.27 KB
/
serverless.yml
File metadata and controls
39 lines (39 loc) · 1.27 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
service: light-switch
provider:
name: aws
runtime: python3.6
region: ${self:custom.region}
stage: ${opt:stage, self:custom.defaultStage}
profile: ${self:custom.profile}
iamRoleStatements:
- Effect: "Allow"
Action:
- "ec2:Start*"
- "ec2:Stop*"
- "ec2:Describe*"
- "rds:Start*"
- "rds:Stop*"
- "rds:DescribeDBInstances"
Resource: "*"
custom:
defaultStage: prod
region: ${self:custom.${self:provider.stage}.region}
profile: ${opt:profile, self:custom.${self:provider.stage}.profile, "default"}
prod:
profile: default
region: "us-east-1"
functions:
light_switch:
environment:
REGION: ${self:custom.region}
handler: app.handler
description: Light Switch Functions
events:
- schedule:
rate: cron(0 10 * * ? *)
name: light_switch_morning_schedule
description: 'This schedule is responsible to turn on or turn off instances'
- schedule:
rate: cron(0 22 * * ? *)
name: light_switch_night_schedule
description: 'This schedule is responsible to turn on or turn off instances'