Skip to content

Pricing when creating a script that continuously creates AMI and copy them to another region

0

Hi,

I am currently writing a script that continuously creates an AMI of an instance. Let's say the instance has an EBS disk of 8TB and the data change rate per day is 50GB. I have a script that basically does :

  • Generate a unique name for the AMI (containing the current date and timestamp)
  • Does a aws ec2 create-image in the current region
  • Wait for the AMI to be available
  • Copy the AMI with a aws ec2 copy-image into the second region
  • Wait for the AMI to be available in the second region
  • restart the first step

As far as I understand, this creates a full EBS snapshot the first time and copies it in the second region (full copy). The subsequent AMI are incremental but their copy are also incremental ?

Also let's suppose that I automatically clean AMIs (and thus snapshots) monthly, I suppose it also recreates a full snapshot and a full copy at some point ?

So will I be charge like this :

  • 8TB per month of snapshots for the first one in each region (16TB)
  • 8TB of data transfer for the first copy per month
  • 1.5TB (30 days * 50GB) per month of subsequent snapshots in each region (3TB)
  • 1.5TB (30 days * 50GB) of data transfer per month and NOT full copies everytime a create a new AMI ? ?
asked a year ago122 views
1 Answer
0

Your understanding of the AMI creation and copying process is generally correct, but let's clarify a few points about the pricing and data management:

  1. Initial AMI creation and copy:
  • The first AMI creation will indeed result in a full EBS snapshot of 8TB in the source region.
  • The first copy to the second region will transfer the full 8TB.
  1. Subsequent AMI creations and copies:
  • In the source region, subsequent AMIs will be incremental, only storing the changed data (50GB per day in your example).
  • When copying to the second region, AWS uses an optimization process. It doesn't transfer the full 8TB each time, but only the changed blocks. So yes, the copies are also incremental.
  1. Monthly cleanup:
  • When you delete older AMIs and their associated snapshots, it doesn't automatically trigger a new full snapshot. AWS manages this efficiently, maintaining the necessary data to keep your most recent AMIs functional.
  • However, over time, as you delete older snapshots, the system may need to consolidate data, which could result in larger data transfers or storage usage temporarily.
  1. Pricing estimate: Your pricing estimate is close, but let's adjust it slightly:
  • You'll be charged for 8TB of snapshot storage in each region initially (16TB total).
  • The first copy will indeed transfer 8TB of data.
  • For subsequent snapshots, you'll be charged for about 1.5TB per month in each region (3TB total) as you calculated.
  • For ongoing copies, you'll be charged for transferring approximately 1.5TB per month, not the full 8TB each time.

It's important to note that while this estimate gives you a general idea, actual costs may vary. Factors such as the specific data change patterns, the efficiency of AWS's incremental snapshot and copy processes, and any consolidation that happens during cleanup can affect the final numbers.

Also, remember that you'll be charged for the storage of all retained snapshots, both in the source and destination regions, for as long as you keep them. Regular cleanup of unnecessary AMIs and snapshots is crucial for cost management.

To optimize costs, consider adjusting the frequency of AMI creation and copying based on your specific recovery point objective (RPO) requirements, and implement a robust cleanup strategy to remove unnecessary AMIs and snapshots regularly.
Sources
Create an Amazon EBS-backed AMI - Amazon Elastic Compute Cloud
Amazon EC2 AMI lifecycle - Amazon Elastic Compute Cloud

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.