Skip to content

shavo007/lambda-start-rds

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scheduled AWS Lambda function to start RDS instances based on tags

This function that runs as a cron job using the serverless schedule event. For more information on schedule event check out the Serverless docs on schedule.

Schedule events use the rate or cron syntax.

Cron syntax

cron(Minutes Hours Day-of-month Month Day-of-week Year)

All fields are required and time zone is UTC only.

Field Values Wildcards
Minutes 0-59 , - * /
Hours 0-23 , - * /
Day-of-month 1-31 , - * ? / L W
Month 1-12 or JAN-DEC , - * /
Day-of-week 1-7 or SUN-SAT , - * ? / L #
Year 1970-2199 , - * /

Read the AWS cron expression syntax docs for more info on how to setup cron

The function is scheduled to execute at 21:00 SUN-THU/UTC time (This is every weekday morning in Melbourne)

Setup

Run nvm use to get the correct version of node

  • Install yarn curl -o- -L https://yarnpkg.com/install.sh | bash
  • Install serverless globally npn install -g serverless

Building

Run yarn after

Deploying

In order to deploy the function run:

yarn deploy:full

There is no additional step required. Your defined schedule becomes active right away after deployment.

Usage

To test function locally and view the results run:

yarn invoke

Update dependencies

yarn upgrade-interactive

Blog post

https://blog.shanelee.name/2017/07/28/how-to-save-costs-with-serverless-and-aws-lambda/

Releases

No releases published

Packages

No packages published