How to automatically create an image of an AWS ec2 instance(AMI)?

+1 vote
I am running an aws ec2 instance. I want to access it manually through aws console and create a daily image of the machine(AMI). Also I want to delete any image older than a week.
Apr 12, 2018 in DevOps on Cloud by Damon Salvatore
• 5,250 points
873 views

3 answers to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
+1 vote

you should try using aws ec2 create-imageaws ec2 describe-images, and aws ec2 deregister-imageu ld together. other than that anything you can do on a web console can be done through cli too.

answered Apr 12, 2018 by DareDev
• 6,520 points
0 votes

AWS lambda would be a right solution to automate the backup of your ami and clean up. You can schedule the lambda function (basically a python code) to run periodically. This way you don't need to have your ec2 running all the time. An example here http://powerupcloud.azurewebsites.net/2016/10/15/serverless-automate-ami-creation-and-deletion-using-aws-lambda/

answered Aug 21, 2018 by Priyaj
• 56,100 points
0 votes

You can use https://github.com/alestic/ec2-consistent-snapshot and run it in a cron job. It supports various filesystems and has support for ensuring database snapshots are consistent. If you don't have a database in your instance, it will still ensure consistent snapshots by freezing the filesystem.

answered Aug 21, 2018 by Priyaj
• 56,100 points

Related Questions In DevOps on Cloud

0 votes
2 answers
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
+4 votes
2 answers

unable to get subdomain of URL in NGINX

You just need to add .+ after ...READ MORE

answered Oct 11, 2018 in DevOps on Cloud by lina
• 8,100 points
447 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.