"Mastering AWS EC2 and EBS: Attach, Mount, Snapshot & Access Data Across Availability Zones"


๐ฐ Introduction
This blog is a practical guide to using Amazon EC2 and EBS together. You'll learn how to attach an extra EBS volume to an EC2 instance, mount and store data, and create a snapshot to access that data from another Availability Zone. It's a complete hands-on tutorial for real-world AWS scenarios like data backup, high availability, and cross-AZ storage access perfect for beginners and DevOps learners.
๐ง What You'll Do
Launch an EC2 instance
Attach an EBS volume
Format and mount it
Add sample data
Create a snapshot
Create a volume in another AZ using that snapshot
Attach to a new EC2 instance
Access the same data cross-AZ
๐ข Step 1: Launch EC2 Instance
Go to AWS Console > EC2 > Launch Instance
Set:
Name:
ebs-task-instance
AMI: Amazon Linux 2
Instance Type:
t2.micro
Key Pair: Create or choose existing
Subnet: e.g.,
us-east-1c
Auto-assign Public IP: Enabled
Security Group: Allow SSH (22), HTTP (80) optional
Keep default 8 GiB EBS
Click Launch
After instance is running, connect via:
ssh -i "aws-key.pem" ec2-user@<public-ip>
๐ข Step 2: Create and Attach EBS Volume
Go to EC2 > Volumes > Create Volume
Set:
Size: 10 GiB
Type:
gp3
AZ:
us-east-1c
(same as EC2)
Create Volume
Select volume โ Actions > Attach Volume
Attach to instance as:
/dev/sdf
๐ข Step 3: Format and Mount EBS Volume
Inside EC2:
lsblk # Check volume as /dev/xvdf
sudo mkfs -t ext4 /dev/xvdf # Format volume
sudo mkdir /mnt/myvolume # Create mount point
sudo mount /dev/xvdf /mnt/myvolume # Mount volume
sudo mkfs -t ext4 /dev/xvdf
๐น Formats the volume/dev/xvdf
with the ext4 filesystem.sudo mkdir /mnt/myvolume
๐น Creates a directory to serve as a mount point for the volume.sudo mount /dev/xvdf /mnt/myvolume
๐น Mounts the formatted volume to the mount point directory/mnt/myvolume
.
๐ข Step 4: Add Sample Data
echo "Hello from Apurv's AWS Volume!" | sudo tee /mnt/myvolume/data.txt
cat /mnt/myvolume/data.txt # Verify file
๐ข Step 5: Create Snapshot of Volume
Go to EC2 > Volumes
Select volume โ Actions > Create Snapshot
Set:
Name:
data-snapshot
Description:
Snapshot for cross-AZ access
Click Create Snapshot
๐ข Step 6: Create Volume in Another AZ from Snapshot
Go to EC2 > Snapshots
Select snapshot โ Actions > Create Volume
Set:
AZ:
us-east-1a
(different from original)Size: 10 GiB
Create volume
๐ข Step 7: Launch Second EC2 in Target AZ
Launch another EC2 instance
Subnet:
us-east-1a
Use same settings as Step 1
๐ข Step 8: Attach Snapshot-Based Volume
Go to EC2 > Volumes
Select new volume โ Actions > Attach Volume
Attach to second EC2 as:
/dev/sdf
๐ข Step 9: Mount and Access Data in 2nd EC2
Inside second EC2:
lsblk
sudo mkdir /mnt/myvolume
sudo mount /dev/xvdf /mnt/myvolume
cat /mnt/myvolume/data.txt # You'll see the same data!
โ Conclusion
In this blog, we covered a complete hands-on process of managing storage in AWS using EC2 and EBS. Starting from launching an EC2 instance, attaching a new EBS volume, formatting and mounting it, to writing custom data each step mirrors real-world AWS workflows.
We then created a snapshot of that volume, and used it to create a new volume in a different Availability Zone, proving that:
You can easily access your data from any Availability Zone in AWS by creating volumes from snapshots and attaching them to instances in the target AZ.
This process is not only useful for cross-AZ data access, but also essential for:
Disaster recovery
High availability setups
Data backups and migration
Whether you're preparing for AWS certification or building scalable cloud systems, mastering these EBS and EC2 operations is a foundational skill every cloud or DevOps engineer should have.
๐จโ๐ป About the Author
This project is a deep dive into the AWS ecosystem designed to strengthen my foundation in cloud-native architecture, automation, and service integration using only AWS services.
From launching EC2 instances, managing storage with S3 and EBS, configuring IAM for secure access, setting up VPCs and subnets, to automating infrastructure with CloudFormation each service I used brought real-world relevance and clarity to cloud concepts.
This series isn't just about using AWS; it's about mastering the core services that power modern cloud infrastructure.
๐ฌ Let's Stay Connected
๐ง Email: gujjarapurv181@gmail.com
๐ GitHub: github.com/ApurvGujjar07
๐ผ LinkedIn: linkedin.com/in/apurv-gujjar
๐ก If you found this project useful, or have any suggestions or feedback, feel free to reach out or drop a comment Iโd love to connect and improve.
This is just the beginning many more builds, deployments, and learnings ahead.
Subscribe to my newsletter
Read articles from Gujjar Apurv directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Gujjar Apurv
Gujjar Apurv
Gujjar Apurv is a passionate DevOps Engineer in the making, dedicated to automating infrastructure, streamlining software delivery, and building scalable cloud-native systems. With hands-on experience in tools like AWS, Docker, Kubernetes, Jenkins, Git, and Linux, he thrives at the intersection of development and operations. Driven by curiosity and continuous learning, Apurv shares insights, tutorials, and real-world solutions from his journeyโmaking complex tech simple and accessible. Whether it's writing YAML, scripting in Python, or deploying on the cloud, he believes in doing it the right way. "Infrastructure is code, but reliability is art."