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,980 points
5,549 views

3 answers to this question.

+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,890 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
• 58,090 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
• 58,090 points

Related Questions In DevOps on Cloud

0 votes
1 answer

How to create user and password in Windows EC2 instance using boto3 Script?

Hi, I don't think AWS will allow you ...READ MORE

answered Sep 23, 2020 in DevOps on Cloud by MD
• 95,440 points
1,843 views
0 votes
2 answers
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,220 points
4,433 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP