Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/shavo007/lambda-start-rds

Start AWS RDS instances based on tag
https://github.com/shavo007/lambda-start-rds

aws aws-lambda eslint nodejs rds yarn

Last synced: 18 days ago
JSON representation

Start AWS RDS instances based on tag

Awesome Lists containing this project

README

        

# 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

```pseudo
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](http://docs.aws.amazon.com/lambda/latest/dg/tutorial-scheduled-events-schedule-expressions.html) 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/