# Using EBS Volume While Snapshot is in Progress

### **Scenario:**

SecureCart, an e-commerce platform, relies on an **On-Demand EC2 instance** with an attached **Amazon EBS volume** to store transaction logs, product inventory data, and real-time analytics. Every night at **12 AM**, SecureCart performs **automated EBS snapshots** to create backups while the system is inactive. However, during a recent incident, engineers needed to make **critical updates** to the application and storage **while the snapshot was in progress**.

#### **Key Question:**

Can SecureCart continue using the EBS volume **while the snapshot process is running**?

✅ **Correct Answer:** **The EBS volume can be used while the snapshot is in progress.**

***

### **1️⃣ Understanding EBS Snapshots and Live Usage**

#### **🔹 What is an EBS Snapshot?**

* **EBS Snapshots are point-in-time backups** of an EBS volume stored in Amazon S3.
* Snapshots are **incremental** – only changed blocks are stored after the first snapshot.
* The snapshot **process does not disrupt** ongoing read/write operations.

#### **🔹 Can You Use an EBS Volume During a Snapshot?**

✔ **Yes, SecureCart’s application can continue reading and writing to the EBS volume** while a snapshot is in progress.\
✔ **Data consistency may be affected** if changes are made while the snapshot is being taken.\
✔ **For application consistency**, it is best to **pause I/O operations** before creating a snapshot.

***

### **2️⃣ How EBS Snapshots Work in SecureCart?**

| **Feature**                   | **Description**                                                                         |
| ----------------------------- | --------------------------------------------------------------------------------------- |
| **Incremental Backups**       | Only changed data blocks are saved after the first snapshot.                            |
| **Asynchronous Process**      | Snapshot creation does not lock the volume.                                             |
| **Data Consistency Concerns** | If updates occur during snapshot creation, the backup might contain **partial writes**. |
| **Instance Usage**            | EC2 instances can continue reading and writing while a snapshot is running.             |

***

### **3️⃣ Key Considerations for SecureCart**

🔹 **Scenario 1: Application Writes to EBS During Snapshot**

* If SecureCart’s **database is updating order transactions**, the snapshot may capture **incomplete changes**.
* Solution: **Flush the database** or pause writes before starting the snapshot.

🔹 **Scenario 2: Restoring Data from an Incomplete Snapshot**

* If SecureCart **restores from a snapshot taken during high activity**, the restored volume may be in an **inconsistent state**.
* Solution: Use **application-consistent snapshots** with AWS Backup or **database quiescing**.

🔹 **Scenario 3: Detaching EBS Volume During Snapshot**

* SecureCart’s team cannot **detach or attach** an EBS volume to a different EC2 instance **until the snapshot completes**.
* Solution: If a detach/attach is needed, **wait for snapshot completion** before modifying volume settings.

***

### **4️⃣ Best Practices for SecureCart’s EBS Snapshots**

✅ **Use Application-Consistent Snapshots** – Pause database writes before snapshot creation.\
✅ **Leverage AWS Backup for Automated Backups** – Ensures full data protection.\
✅ **Enable Multi-Volume Snapshots for EC2 Instances** – Ensures consistency across multiple attached EBS volumes.\
✅ **Monitor Snapshot Progress Using AWS CloudWatch** – Track snapshot status to prevent conflicts.

🔹 **Example AWS CLI Command to Create a Snapshot with Tags:**

```sh
shCopyEditaws ec2 create-snapshot --volume-id vol-0123456789abcdef0 --description "Nightly backup" --tag-specifications 'ResourceType=snapshot,Tags=[{Key=Name,Value=SecureCartBackup}]'
```

***

### **5️⃣ Common Mistakes to Avoid**

| **Mistake**                                                                   | **Why It's a Problem**                         | **Solution**                                             |
| ----------------------------------------------------------------------------- | ---------------------------------------------- | -------------------------------------------------------- |
| Assuming the EBS volume is unavailable during a snapshot                      | Leads to unnecessary downtime and delays       | **Continue using the volume** during the snapshot        |
| Modifying the volume structure (detaching/attaching) during snapshot creation | Can cause snapshot failures or inconsistencies | **Wait until the snapshot is complete** before modifying |
| Not using AWS Backup for automated backups                                    | Can lead to data loss or incomplete recovery   | **Implement AWS Backup for scheduled snapshots**         |
| Failing to monitor snapshot progress                                          | Can impact system changes or recovery plans    | **Use AWS CloudWatch and SNS alerts**                    |

***

### **6️⃣ Summary & Key Takeaways**

🚀 **EBS Snapshots allow SecureCart to back up data without stopping the application.**\
🚀 **EC2 instances can read/write to EBS volumes during snapshot creation.**\
🚀 **Detaching or attaching an EBS volume should only be done after the snapshot is complete.**\
🚀 **Best practice: Use application-consistent snapshots for databases and critical systems.**

***

#### **🔹 Hands-On Lab: Creating and Using EBS Snapshots in SecureCart**

🔹 **Goal:** Verify that SecureCart’s EC2 instance can continue using an EBS volume while taking a snapshot.\
🔹 **Tools Used:** AWS CLI, AWS Management Console, AWS Backup.

✅ **Step 1:** Create an EBS Snapshot using AWS CLI:

```sh
shCopyEditaws ec2 create-snapshot --volume-id vol-0abcdef1234567890 --description "SecureCart Order Database Backup"
```

✅ **Step 2:** Confirm that the **EC2 instance continues running** without issues.\
✅ **Step 3:** Monitor snapshot progress using:

```sh
shCopyEditaws ec2 describe-snapshots --snapshot-ids snap-0abcdef1234567890
```

✅ **Step 4:** Restore a new volume from the snapshot:

```sh
shCopyEditaws ec2 create-volume --snapshot-id snap-0abcdef1234567890 --availability-zone us-east-1a
```

✅ **Step 5:** Attach the new volume to an EC2 instance and verify data integrity.

***

#### **Final Thought**

By properly **managing EBS snapshots**, SecureCart ensures **business continuity, data security, and efficient recovery** without downtime. 🚀


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://awsinpractice.itassist.com/study-group/aws-certified-solutions-architect-associate/domain-1-design-secure-architectures/task-statement-1.3-determine-appropriate-data-security-controls/use-cases/using-ebs-volume-while-snapshot-is-in-progress.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
