This lambda is Stop and Start RDS, EC2, ASG and ECS services based in TAG defined
Execute lambda with event in format as shown below
var | value |
---|---|
hh | hour that is in the resource tag start or stop |
{"ec2": {"hour": "10", "day": "fri"}}
{"rds": {"hour": "8", "day": "mon"}}
{"ecs": {"hour": "5", "day": "fri"}}
EC2 accept json or list format
- Monday to Friday
JSON Format
{"workday": {"start": 8, "stop": 22}}
List Format
workday_start=8 workday_stop=22
AutoScaling Groups accept json or list format
- Monday to Friday
JSON Format
{"workday": {"start": 8, "stop": 22}}
List Format
workday_start=8 workday_stop=22
RDS only list format is accepted
- Thursday
List Format
thu_start=7 thu_stop=19
ECS only list format is accepted
List Format
daily_start=8 daily_stop=20 daily_stop-desired=1
If desired is 0, then daily_stop-desired can be removed
daily_start=8 daily_stop=20
In order to deploy the lambda to the Client, it is necessary to have awscli configured with the Secret Keys of the Client account.
Create copy of file .env.example like .env.prod
cp .env.example .env.prod
Change the env for the Client who will Deploy the function if necessary
Install plugins serverless framework
serverless plugin install -n serverless-python-requirements
serverless plugin install -n serverless-dotenv-plugin
serverless plugin install -n serverless-plugin-resource-tagging
serverless deploy --stage prod
serverless remove --stage prod