Y NOT — Play Around Moving EBS Volumes Across Different Regions on AWS Platform
EBS(Elastic Block Storage)Volume is a network drive (not a physical drive) that we can attach to EC2 Instances on the fly. It allows EC2 Instances to persist data even after their termination. EBS Volume can be only mounted to one EC2 Instance at a given point of time even though it can be detached and mounted to different EC2 Instance. However, one EC2 Instance can have one or many EBS Volumes mounted to it. An analogy for EBS Volumes would be to think of them as “network USB Stick” which can be attached/detached.
“ Delete on Termination” attribute while attaching EBS to EC2 Instance dictates the EBS Volume behavior upon termination of an EC2 Instance to which it is attached. By Default, only root EBS Volumes are deleted (this attribute is enabled) upon its associated EC2 instance termination. However, this can be customized/controlled by user using the “Delete on Termination” attribute.
EBS Volumes are bound to be specific to Availability Zone. As it is locked to specific Availability Zone, we cannot move them to another AZ/Region by default. However, this is achievable through Snapshots.
Make a backup (snapshot) of EBS Volume at a given point of time using EBS Snapshots. It is not necessary, but RECOMMENDED to detach the EBS Volume before taking a snapshot. Using this snapshot, EBS Volumes can be restored in same/different Availability Zones (AZ) of the same Region. This snapshot can also be copied across Regions for restoring back EBS Volumes across Regions. Implicitly, each snapshot is stored in S3 bucket (which is a global service).
Step 1: I have launched an EC2 Instance on Mumbai Region (ap-south-1a) with EBS as its Root Volume. For more details on launching EC2 Instance, please feel to refer https://nagarajansivathanu.medium.com/y-not-launch-an-ec2-instance-in-aws-cloud-platform-dfddfe79b728
Step 2: Create a Snapshot of this EBS Volume. Navigate to EC2 Service and choose Snapshots under Elastic Block Store
Step 3: Click Create Snapshot and choose the volume for which snapshot to be created, give a description and add necessary tags if needed and proceed
Step 4: To restore an EBS Volume using this created snapshot on different availability zone of same region, choose “Create Volume” on Actions
Step 5: Choose Volume Type and Size (greater than or equal to that of snapshot) and choose from one of the different Availability Zones on that given region and proceed to Create Volume.
Volume got created and now we can see same copy of volumes are available on two different AZ within Mumbai
To create a Volume based on this snapshot on different Region, first choose Copy under Snapshots (Action)
Choose a different Region where we need to copy this snapshot. I have initiated a copy of snapshot from Mumbai Region to Ohio Region
Navigate to Ohio Region and go to snapshots section to verify if the snapshot has been copied.
Once copied, we can follow the same steps starting Step 4 for restoring an EBS volume using this copied snapshot on Ohio (different Region).
Hope you enjoyed this article!