It is very important to create backups for your crutial EC2 instances. While AWS provides mechanisms to increase availability, the cloud is not infallible.
EC2 provides a native backup format for your EC2 instances in the way of AMI images. But storage costs of the AMI images can build over time.
Storage in S3, GB-for-GB, is cheaper than EBS snapshots. For example, the starting price for 1 GB of EBS snapshots is $0.05 per month, compared to $0.23 for 1 GB of data stored in S3. So if you can move your AMI images to S3, you may be able to lower your storage costs.
AWS now provides a built-in function to copy AMI images to S3 buckets through a new
aws ec2 create-store-image-task CLI command. At this time, this feature is quite limited.
Scheduling and automating this function can be very helpful in keeping your AMI images archived in S3. To help you with this, Skeddly has added a new action: Copy AMI Images to S3.
Using this new action, you can copy your AMI images on a schedule. In addition, the action includes additional features.
AMI images can be selected in many ways:
You can also limit AMI image selection to those newer and/or older than a specified number of days.
By default, AWS will only store the AMI image in the root folder of your S3 bucket. Skeddly takes things even further.
First off, AWS limits the copying of the AMI image to an S3 bucket in the same region. You can specify multiple buckets in multiple regions, and Skeddly will figure out which buckets to use for each region.
Next, AWS also only deposits the AMI image in the root folder of the S3 buckets. Skeddly takes things further. You can specify any location in S3, and Skeddly will copy the object there.
Finally, you can override the storage class and encryption of the objects if you so choose.
Once your AMI images are in S3, you can:
a) Copy them to another S3 bucket, and/or b) Restore them back to AMI images.
To restore an AMI image from your S3 bucket, you use the AWS CLI:
$ aws ec2 create-restore-image-task \ --region us-east-1 \ --bucket my-bucket-in-us-east-1 \ --key "copy-ami-images/2021-05-10/ami-12345678.bin" \ --name "My New AMI"
One word of warning.
EBS snapshots (which AMI images use to store data from EBS volumes), are optimized to only store, and charge the user for, changes in the data blocks. So two AMI images created from the same EC2 instance may not be storing data twice (like incremental backups).
But copying two AMI images from the same EC2 instance to distinct S3 objects will store the data in S3 twice (like two full backups).
Use caution when storing multiple AMI images from the same EC2 instances in S3. The costs may end up being higher in S3.
Please contact Skeddly support if you’d like to discuss this in more detail.
This new action is available today. Pricing for it can be found on Skeddly’s pricing pages.