"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-instanceAMI: Amazon Linux 2
Instance Type:
t2.microKey Pair: Create or choose existing
Subnet: e.g.,
us-east-1cAuto-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:
gp3AZ:
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/xvdfwith 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-snapshotDescription:
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-1aUse 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.






