0% found this document useful (0 votes)
16 views17 pages

Ebs Vol and Snapshot in Aws

Ebs vol and snapshot in aws.

Uploaded by

waghprashant98
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views17 pages

Ebs Vol and Snapshot in Aws

Ebs vol and snapshot in aws.

Uploaded by

waghprashant98
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Abhishek Badak

Mastering EBS Volumes and


Snapshots: A Seamless Guide to Data
Migration Across AWS Regions
Seamless Data Store, Recovery and Cost-Effective Backup.
Introduction to AWS EBS
AWS Elastic Block Store (EBS) is a scalable, high-performance block storage solution, that
seamlessly integrates with Amazon EC2 instances. It offers reliable and persistent
storage, making it a crucial asset for a diverse range of applications. AWS EBS
volumes provide storage for databases, le systems, or application data that demands
frequent updates and rapid access. Its exibility and reliability ensure that your data is
always accessible, supporting your business needs regardless of the scale.

What is EBS Volume?

At its core, an EBS volume is a durable block-level storage device that can be attached to
an Amazon EC2 instance. Think of it as a virtual hard drive in the cloud, capable of
persistently storing data even after an EC2 instance is terminated. EBS volumes offer high
availability and reliability, making them ideal for a wide range of applications, from hosting
databases to storing application les.

You can attach multiple EBS volumes to a single instance. The volume and instance must
be in the same Availability Zone. Depending on the volume and instance types, you can
use Multi-Attach to mount a volume to multiple instances at the same time.
fi
fl
fi
EBS Snapshots
An EBS snapshot is an incremental backup of an Amazon EBS volume. This means that
only the data that has changed since the last snapshot is backed up. EBS snapshots are
stored in Amazon S3 but are managed by EBS for you, making them easy to use for
backup, recovery, and migration of EBS volumes.

Here’s a quick breakdown of how incremental backups work:

• Day 1: The initial snapshot copies the entire EBS volume. It takes a complete
backup of all the data present on the volume, known as a “full backup.”

• Day 2: Only the data that has changed since the last snapshot is backed up. For
example, if new data was added to the volume, the snapshot only saves the newly
added or modi ed data.

• Day 3 and beyond: Subsequent snapshots continue to back up only the


changed blocks of data. This incremental backup process reduces storage costs and
speeds up the backup process.

This means that, for every snapshot after the rst one, you are not backing up the entire
volume again, but just the changes, which saves both time and resources.
fi
fi
Part 1: Preparing for Migration in the Source Region
Navigate to the region section and Log in to the EC2 instance in
the target region want to work in. In this case we have selected
North Virginia.

Step1:- Navigate to the EC2 Dashboard.


Select an Amazon Machine Image(Amazon Linux AMI ) and we name that
instance as Vol-01.

Con gure the Network Setting and select the Availability Zone(Az)
under the Subnet. Our Az is us-east-1f and then launch an EC2 instance.
fi
Step2 :- Creating EBS Volumes
Before that establish the connection with the Ec2 Instance, and check the all
the block devices (like hard drives, SSDs, USB drives, and partitions)
attached to the operating system using lsblk ’ command.

Now Create an EBS Volume


After your instance is running, navigate to Volumes under Elastic Block
Store in the EC2 Dashboard. Click on Create Volume. Con gure the volume
type, size, and availability zone (ensure it matches your instance's AZ). Click
Create Volume.

Primary-Vol is the default volume created at the time of instance creation.

Select the same Az which you selected while creating an Ec2 Instance

Az’s

fi
Step 3: Attach the EBS Volume to the Instance
Select the newly created volume. Click on Actions and choose Attach
Volume. Select your EC2 instance, Device Name and click Attach.
External-Vol
is the latest
volume
created.

Once again re lsblk and to make sure about the new volume is attached.

In this case the the attached volume name is ’/dev/xvde’


fi
Then create new partitions on the volume using sudo parted’. Followed by
the parted commands or subcommands.

Once again re lsblk and to check the new volume partition on externally
attached disk. In this case we get /dev/xvde1’
fi


Create a lesystem on a speci ed storage device or partition i.e. on /dev/
xvde1 using sudo mkfs.ext4 /dev/xvde1’.

Create a directory to serve as a mount point. to, using sudo mkdir /test’.
After creating a lesystem with mkfs, you typically need to mount the
partition to make it accessible for read and write operations.

Mount the volume partition using mount /dev/xvde1 /test’. This


command mounts the partition to the directory /test, allowing you to access
the les on that partition.

Then use lsblk’ or df -h’ to check the mount point.

Navigate to the directory /test and create les. In this case we created les
just to verify that date is recovered when we will attach this volume to
another instance on a different AWS Region.
fi
fi


fi

fi

fi

fi
Step 4: Create a Snapshot of the EBS Volume
In the Volumes section, select the attached EBS volume. Click on Actions
and select Create Snapshot.

Enter a description and click Create Snapshot. Monitor the snapshot


creation in the Snapshots section. Give description to the snapshot because
it makes easy to identify the snapshot. Description is not naming a Snapshot.

Again Navigate to the directory /test and create les.

Take another snapshot of the newly added data.


fi
By now we have created two snapshots those are Snap1- contains the
backup.zip le and Snap2- contains backup.zip and data.zip les

Step 5: Terminate the Ec2 Instance and detach External Volume


Primary-vol(Volume created at the time of creating an Ec2 instance) will be
remove by default when we terminate the Instance.

Locate the volume you want to detach. Select the volume and click on the
Actions dropdown menu. Choose Detach Volume.

Important Considerations
• Data Safety: Ensure that any data on the volume is saved and that the volume
is not in use (e.g., not mounted) before detaching to prevent data loss.

• Instance State: You can detach a volume from an instance that is running or
stopped, but it’s generally a good practice to stop the instance if the volume
contains critical data or is the root volume.

After detaching, the volume will be available in your account and can be attached
to another instance or deleted if no longer needed.
fi
fi
Part 2: Preparing for Migration in the Source Region
Navigate to the region section and Log in to the EC2 instance in
the target region to work in. In this case we have selected Mumbai.

Step1:- Navigate to the EC2 Dashboard.


Select an Amazon Machine Image(Ubuntu) and we name that instance as
Vol-02.Con gure the Network Setting and select the Availability Zone(Az)
under the Subnet. Our Az is ap-south-1 and then launch an EC2 instance.
fi
Establish the connection with the Ec2 Instance(Vol-02), and check the all the
block devices (like hard drives, SSDs, USB drives, and partitions) attached to
the operating system using lsblk ’ command.

Step 2:- Copy the Snapshot to Another Region

• Go to the Snapshots section and select the snapshot you created.


• Click on Actions and choose Copy Snapshot.

• Choose the Destination Region.


• Con gure encryption settings if needed and click Copy Snapshot.
• Monitor the copy progress in the target region's snapshots section.

There is the list of Destination Region where you want to

copy your Snapshot in this case we are copying


snapshot from us-east-1 to ap-south-1 .
fi

copy another snapshot the region ap-south-1 and name it.

Step 3: Create an EBS Volume from the Copied Snapshot


• Switch to the target region in the AWS Management Console.

• Navigate to Snapshots and locate the copied snapshot.

• Select the snapshot and click on Actions, then choose Create Volume.

• Specify the volume type, size, and availability zone, then click Create
Volume.
Step 4: Attach the New EBS Volume to an EC2 Instance in the
Target Region
• In the target region, go to the Volumes section.
• Select the new volume and click Actions, then choose Attach Volume.

• Select the EC2 instance to attach the volume to and click Attach.

Step 5: Verify Data Integrity


Check that the data from the EBS volume is accessible and
functioning as expected.
Step 6 : Repeat Step no. 3,4,5 to create volume for 2nd snapshot
Check that the data from the EBS volume is accessible and
functioning as expected.

B-snap-vol

D-snap-vol

• Create a directory named /test1 and /test2


• Mount the volume partition using mount /dev/xvde1 /test1’.
• Navigate into the /test1 directory and list the data. And as you re the ls
command in /test1 directory you will se we have recovered data
successfully.
• Again mount the volume partition using mount /dev/xvdf1 test2’ .i.e.
the 2nd volume we attached. And verify that we have recovered data
successfully by navigate into the /test2 directory and list the data.


fi
Step 7: Finalizing the Migration
Clean Up
• Delete any unnecessary snapshots or volumes in the source region to save
costs.
• Document the migration process for future reference.

Best Practices

• Conduct test migrations to ensure the process works smoothly.


• Use CloudWatch to monitor performance metrics of your EBS volumes.
• Schedule regular snapshots for ongoing data protection.

This comprehensive guide walks you through creating an EC2 instance, managing EBS
volumes and snapshots, and migrating data between AWS regions.

Thank you……

You might also like