Why is my AMI or EBS snapshot creation slow or stuck in the Pending state?

3 minute read
0

I'm creating an Amazon Machine Image (AMI) or snapshot of my Amazon Elastic Compute Cloud (Amazon EC2) instance or Amazon Elastic Block Store (Amazon EBS) volume. However, the process is slow or is stuck in the Pending state.

Short description

During Amazon EBS-backed AMI creation, the AMI moves from the Pending to Available state after the snapshot is complete. EBS-backed AMI or snapshot creation might be slow because you're copying large amounts of data to Amazon Simple Storage Service (Amazon S3). Many factors, such as write activity on the EBS volume, impact creation time. Therefore, creation times for snapshots vary.

Note: Snapshots that are associated with an AMI are listed under Snapshots in the Amazon EC2 console. To filter these snapshots, enter the AMI ID in the search bar on the Snapshots page.

Resolution

Dirty blocks

Dirty data that Amazon EBS copies to Amazon S3 is the most common cause for slow AMI or snapshot creation. Dirty data is measured by the number of blocks. The following factors might result in a large number of dirty blocks:

  • Size of the EBS volume
  • Time since last snapshot
  • Write activity on the volume

Snapshots are designed to be incremental. This means that Amazon EBS copies only the blocks that changed since you created the last snapshot. An EBS volume might not have an existing snapshot, or previous snapshots might have been deleted. In these cases, the blocks are considered dirty because you can't compare the blocks against any snapshot.

Also, older snapshots or very active EBS volumes might have a large number of blocks that you must copy as part of the new snapshot.

It's a best practice to create snapshots frequently. Creating snapshots more frequently reduces the number of blocks to copy for each snapshot. You can use Amazon Data Lifecycle Manager to automate the creation, retention, and deletion of snapshots for your EBS volumes. Set the snapshot frequency based on your Recovery Point Objective (RPO). EBS snapshots are charged for the incremental data that's saved in Amazon S3, not the number of snapshots. For more information, see Amazon EBS pricing.

Multiple volumes queued for snapshot creation

During snapshot creation, Amazon EBS uses a shared bandwidth to send data to Amazon S3. If you're creating multiple snapshots, then you might encounter delays. Delays might also occur if you create several snapshots at the beginning of an hour. For example, if you have an automated process to create snapshots exactly at midnight, then this can delay snapshot creation.

It's a best practice to create snapshots at various times past the hour. You can use Amazon Data Lifecycle Manager to automatically create snapshots within an hour after the scheduled start time, instead of immediately creating snapshots.

Stacked snapshots

When you create multiple snapshots for the same volume within a short period of time, the following actions occur:

  • The first snapshot is created.
  • Other snapshots are moved to the Pending state.

Snapshot creation in the Pending state doesn't progress until the first snapshot creation is completed. Deleting a snapshot that's in the Pending state doesn't stop the creation process. If you try to delete the snapshot that's in the Pending state, then the snapshot is created first before it's deleted.

To resolve this issue, avoid creating snapshots when snapshot creation for a volume is in progress.

Related information

My Amazon EBS snapshots show no progress or receive the error "ConcurrentSnapshotLimitExceeded". How can I resolve this?

AWS OFFICIAL
AWS OFFICIALUpdated 7 months ago