Pumoxi

Amazon Elastic Block Storage is a block storage solution offered by AWS for Amazon Elastic Compute Cloud (EC2). However, it is not possible to move the EBS volume across availability zone and region directly.

This post will show the workaround to move the volume to another region.

Why Move EBS Volume Across Regions?

  1. Disaster Recovery: Keep a backup of the EBS Volume in another region to mitigate the impact of regional outages.
  2. Cost Optimization: To move data to another region with lower operational costs.
  3. Compliance: To align with regulatory requirements.
  4. Latency: Move data to region closer to users

Key Considerations

  1. Cost: Data transfer cost when moving data across regions.
  2. Permission: Your IAM credentials have the necessary permissions to create and access snapshots and volumes.

Steps to move EBS Volumes

Create Snapshot of the EBS Volumes

  1. Access to AWS Management Console, navigate to EC2.
  2. From the side navigation panel, access to Volumes.
  3. Select the volume and click on the Actions > Create snapshot.

Copy the Snapshot to the Target Region

  1. From the side navigation panel, access to Snapshots.
  2. Select the snapshot created, click on the Actions > Copy snapshot.
  3. Select the Destination Region, click on the Copy snapshot.

Create a Volume from the Snapshot in the Target Region

  1. Switch to the target region in the AWS Management Console, navigate to EC2.
  2. From the side navigation panel, access to Snapshots
  3. Select the snapshot created, click on the Actions > Create volume from snapshot.

Attach the Volume to an EC2 Instance

  1. From the side navigation panel, access to Volumes.
  2. Select the volume created, click on the Actions > Attach Volume
  3. Select the EC2 instance and click Attach.

The volume had now been copied from region A to region B.

Useful Linux Command


Verify the EBS Volume is Attached

Use the following command to list block devices.

lsblk

Create a Filesystem

If the EBS volume is new and doesn’t have a file system, use the following command to create an ext4 filesystem

sudo mkfs.ext4 /dev/xvdf

Note: Replace /dev/xvdf with the actual device name for your volume


Mount the Volume

Create a directory to use as a mount point, and mount the EBS volume to the directory

sudo mkdir /my-ebs-volume
sudo mount /dev/xvdf /my-ebs-volumne
Example output
Example output of the Linux Command to create the filesystem and mount the volume

Reference

https://docs.aws.amazon.com/ebs/latest/userguide/ebs-using-volumes.html


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.


Discover more from Pumoxi

Subscribe now to keep reading and get access to the full archive.

Continue reading