create-images is an AWS Lambda function for use with Lambder.
- python-lambder
This lambda function creates an Amazon Machine Image from each EC2 instance tagged with Key: 'LambderBackup'. By default, instances will not be rebooted during the image creation process. The function will retain at most 3 images and delete the oldest images to stay under this threshold.
- Clone this repo
cp example_lambder.json lambder.json
- Edit lambder.json to set your S3 bucket
lambder functions deploy
Schedule the function with a new event. Rember that the cron expression is based on UTC.
lambder events add \
--name CreateImages \
--function-name Lambder-create-images \
--cron 'cron(0 6 ? * * *)'
- Parameterize the tag in the input event object
- Parameterize number of old images to retain
- Parameterize no-reboot option