As companies, big or small, move into the cloud, it’s becoming more and more important to ensure that data is protected. There are numerous options for data resilience, including (but not limited to), Amazon EBS and Amazon S3. What you choose to use depends on your business requirements.
Amazon EBS volumes are supposed to be redundant within an availability zone, however they have been known to fail, both due to technical issues, and by human error.
When storing important data in your EC2 instances, a sound backup strategy is vital.
AWS provides an EBS-native backup option in the form of EBS snapshots. AMI images take that one step further in that an AMI image includes EBS snapshots for each attached EBS volume in addition to metadata about the EC2 instance itself. With an AMI image, you can replace a “broken” EC2 instance very quickly.
So, if your EC2 instances contain data that cannot be lost, creating daily AMI images can be key to ensuring your business stays in business.
You can create an AMI image from your EC2 instance using the AWS Management Console.
Depending on the size of the EBS volumes and when the last EBS snapshots were created, the AMI image may take just a few minutes to complete, or it may take several hours.
While you’re waiting, you can add tags to the AMI image and EBS snapshots for cataloging and costing.
Doing this on a daily basis requires you to sign-in to the AWS Management Console every day and repeat this process.
Another option for creating AMI images is to use the AWS CLI or any of the AWS SDKs readily available. Here is the command for the AWS CLI to create an AMI image:
aws ec2 create-image \ --region us-east-1 \ --instance-id i-1234567890 \ --name my-ami-image-2018-01-24
To tag the AMI image:
aws ec2 create-tags \ --region us-east-1 \ --resources ami-12345678 \ --tags Key=Creator,Value=Matt
Much fewer mouse clicks and you can put these into a script.
Once scripted, you can use cron on an EC2 instance, Lambda triggered by CloudWatch events, step functions, etc. to make this happen daily.
However, with all of these solutions:
And what about copying it to another region or AWS account? Or command throttling, or other AWS errors and outages that occur?
Wouldn’t it be awesome if someone had already put together a system where you can create your daily AMI images with just a few mouse clicks, images and tags can be customized, logging and auditing is easy, and you don’t have to manage anything else?
There is! Creating daily AMI images is extremely easy using Skeddly.
Just set up your schedule. You can choose the time of day, time zone, and the day of the week on which the backups happen.
Choose your EC2 instances. You can choose to backup all instances, instances with certain EC2 instance IDs, or those that match specific resource tags.
Customize your backups. You can choose your AMI image name, and include dynamic data such as dates and times. You can add tags and even copy tag values from the EC2 instances.
And easy copying to another region or AWS account. Simply select the region and account.
Your AMI images will be created daily, with full logs, and error handling. And you won’t have to work Saturdays to create the backups.