Search code examples
amazon-web-servicesamazon-ec2snapshot

How AWS handle the changes while snapshot is being created (both EBS and EC2 instance)?


When creating a snapshot on the AWS console. After click creating the snapshot, it takes a while before it finishes. Let's say 5-10 minutes.

  1. Will it captures any changes that happened during that time window?
  2. If it doesn't capture those changes, how does AWS achieve that since the resources keep changing and how does it know the state of the resource before change happens?

Solution

  • An Amazon EBS volume is a 'virtual disk'. It is not an actual physical disk. Rather, Amazon EBS is a SAN-like storage service where each block is allocated and stored separately. There is an index of all the blocks that point to where they are stored. Thus, it can keep track of which blocks are used, unused and changed.

    When an Amazon EBS Snapshot is created, it looks at the 'index' to determine which blocks are currently in-use. It then copies those blocks into Snapshot storage. (It's pretty smart -- only blocks that have been added or changed since the last Snapshot are copied.) Any blocks that change after the Snapshot is started will not be included in the Snapshot. The EBS service can track all of those blocks and knows which ones were created at what time. Blocks are even replicated between devices in case of failure.

    Bottom line: Don't apply traditional disk concepts to Amazon EBS. Trust that it does its job, and does it well.