Skip to content

Instantly share code, notes, and snippets.

@mindlapse
Last active August 19, 2019 01:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mindlapse/dd3d83e281d67bb83382dd739d3c0a9a to your computer and use it in GitHub Desktop.
Save mindlapse/dd3d83e281d67bb83382dd739d3c0a9a to your computer and use it in GitHub Desktop.
service: sleepmode # NOTE: update this with your service name
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