Skip to content

Instantly share code, notes, and snippets.

@mindlapse
Created August 18, 2019 20:20
Show Gist options
  • Save mindlapse/4fa029b808f24276f9b62b84b7cedcfa to your computer and use it in GitHub Desktop.
Save mindlapse/4fa029b808f24276f9b62b84b7cedcfa to your computer and use it in GitHub Desktop.
service: sleepmode
provider:
name: aws
runtime: nodejs10.x
iamRoleStatements:
- Effect: "Allow"
Action:
- "ec2:DescribeInstances"
- "ec2:DescribeInstanceStatus"
- "ec2:StopInstances"
- "sns:Publish"
Resource: "*"
environment:
TAG: Sleepy
SNS_TOPIC_ARN: 'arn:aws:sns:us-east-1:1234567890123:sleepmode'
functions:
goodmorning:
handler: handler.goodmorning
events:
- schedule: cron(0 12 * * ? *)
goodnight:
handler: handler.goodnight
events:
- schedule: cron(0 22 * * ? *)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment