stop-instances is an AWS Lambda function for use with Lambder.
- python-lambder
This lambda function stops any EC2 instances that match the following:
- instance is running
- instance is tagged with Key: 'LambderStop'
It is usually paired with lambder-start-instances and used to run instances only during business hours to save money.
- Clone this repo
cp example_lambder.json lambder.json
- Edit lambder.json to set your S3 bucket
lambder function deploy
Schedule the function with a new event. Rember that the cron expression is based on UTC.
lambder events add \
--name StopInstances \
--function-name Lambder-stop-instances \
--cron 'cron(0 0 ? * MON-FRI *)'
- Parameterize the tag in the input event object