5

I have an EC2 instance with an EBS backed root volume. The OS hasn't been updated in some time and I'd like to remedy that, but I need a rollback plan in case the updates cause issues.

I think I know what to do, but I was hoping to have someone sanity check my plan before making changes. Does the following seem reasonable?

Update:

  1. Create snapshot of root volume; wait for it to complete.
  2. Update O.S.

Rollback:

  1. Create new volume from snapshot.
  2. Stop instance.
  3. Detach root volume.
  4. Attach volume created from snapshot as new root volume.
  5. Start instance.

Reasonable?

jph
  • 153
  • 2

1 Answers1

7

Yes, you have the gist of it. A couple of things to point out.

If you can shut off the server before you take the snapshot you're guaranteed to get all the data that may be cached for writing.

You can take a snapshot of an attached volume that is in use. However, snapshots only capture data that has been written to your Amazon EBS volume at the time the snapshot command is issued. This might exclude any data that has been cached by any applications or the operating system. If you can pause any file writes to the volume long enough to take a snapshot, your snapshot should be complete.

Second, the snapshot may not be available immediately. If you'd have to restore quickly you should wait for the snapshot to be out of the pending state.

Snapshots occur asynchronously; the point-in-time snapshot is created immediately, but the status of the snapshot is pending until the snapshot is complete (when all of the modified blocks have been transferred to Amazon S3), which can take several hours for large initial snapshots or subsequent snapshots where many blocks have changed

References

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-creating-snapshot.html

kenlukas
  • 3,101
  • 2
  • 16
  • 26