Ebs Vol and Snapshot in Aws
Ebs Vol and Snapshot in Aws
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.
• 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.
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.
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.
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.
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.
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.
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.
• 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.
B-snap-vol
D-snap-vol
Best Practices
This comprehensive guide walks you through creating an EC2 instance, managing EBS
volumes and snapshots, and migrating data between AWS regions.
Thank you……