# "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 &gt; EC2 &gt; 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:
    

```powershell
ssh -i "aws-key.pem" ec2-user@<public-ip>
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1752206422638/2b1fe6c7-3c91-43ba-ac1f-eedecedc7f76.png align="center")

## 🟢 **Step 2: Create and Attach EBS Volume**

* Go to **EC2 &gt; Volumes &gt; Create Volume**
    
* Set:
    
    * Size: 10 GiB
        
    * Type: `gp3`
        
    * AZ: `us-east-1c` (same as EC2)
        
* Create Volume
    
* Select volume → **Actions &gt; Attach Volume**
    
* Attach to instance as: `/dev/sdf`
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1752206535570/12129e10-8a8a-42b8-a004-6d4add83ce21.png align="center")

## 🟢 **Step 3: Format and Mount EBS Volume**

Inside EC2:

```powershell
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
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1752206602317/c3e29112-6cf4-4fc1-9a5d-3b6214d36bb4.png align="center")

* `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**

```powershell
echo "Hello from Apurv's AWS Volume!" | sudo tee /mnt/myvolume/data.txt
cat /mnt/myvolume/data.txt     # Verify file
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1752206699311/4327c67b-476a-42a0-a19c-ae49c91db071.png align="center")

## 🟢 **Step 5: Create Snapshot of Volume**

* Go to **EC2 &gt; Volumes**
    
* Select volume → **Actions &gt; Create Snapshot**
    
* Set:
    
    * Name: `data-snapshot`
        
    * Description: `Snapshot for cross-AZ access`
        
* Click **Create Snapshot**
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1752206805819/0c7e8ca5-f0c2-4baf-a057-cf602fe47b75.png align="center")

## 🟢 **Step 6: Create Volume in Another AZ from Snapshot**

* Go to **EC2 &gt; Snapshots**
    
* Select snapshot → **Actions &gt; Create Volume**
    
* Set:
    
    * AZ: `us-east-1a` (different from original)
        
    * Size: 10 GiB
        
* Create volume
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1752206898163/5b7a2006-9c7f-4576-b4db-05261c26490c.png align="center")

## 🟢 **Step 7: Launch Second EC2 in Target AZ**

* Launch another EC2 instance
    
* Subnet: `us-east-1a`
    
* ### **<mark>Use same settings as Step 1</mark>**
    

## 🟢 **Step 8: Attach Snapshot-Based Volume**

* Go to **EC2 &gt; Volumes**
    
* Select new volume → **Actions &gt; Attach Volume**
    
* Attach to second EC2 as: `/dev/sdf`
    

## 🟢 **Step 9: Mount and Access Data in 2nd EC2**

Inside second EC2:

```powershell
lsblk
sudo mkdir /mnt/myvolume
sudo mount /dev/xvdf /mnt/myvolume
cat /mnt/myvolume/data.txt    # You'll see the same data!
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1752207086660/6e5b8af4-8c64-4ee2-bb20-5d2d79ca0ba6.png align="center")

## ✅ **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**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1751797710818/123a7231-3dca-4273-ad68-7bd026f69b95.png?auto=compress,format&format=webp align="left")

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**](mailto:gujjarapurv181@gmail.com)
    
* 🐙 **GitHub**: [**github.com/ApurvGujjar07**](https://github.com/ApurvGujjar07)
    
* 💼 **LinkedIn**: [**linkedin.com/in/apurv-gujjar**](https://www.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.***
