> ## Documentation Index
> Fetch the complete documentation index at: https://cloud-architect.ipoint-labs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# EBS Multi- Attach

> Hands-on lab · 45m

Launch this lab in the IP Lab Portal, then follow the steps below in the AWS console.

<a className="ip-lab-portal-btn" href="https://labs.intellectualpoint.com/labs/ebs-multi-attach" target="_blank" rel="noreferrer">
  Open IP Lab Portal
</a>

## Overview

### Lab Details

1. In this lab, you will set up and test the Amazon EBS Multi-Attach feature within a Virtual Private Cloud (VPC) using two EC2 instances running Amazon Linux 2023. You'll create a Multi Attach enabled EBS volume and attach it to both instances. On the first instance, you'll format and mount the volume with the ext4 file system, create a test file, and then mount the same volume as read-only on the second instance to safely read that file.
2. Duration: **45 minutes**.
3. AWS Region: **US East (N. Virginia) us-east-1**.

### Introduction

#### What is EBS Multi-Attach?

* **EBS Multi-Attach** is an Amazon Elastic Block Store (EBS) feature that allows you to attach a single EBS volume to multiple EC2 instances at the same time — as long as the instances are in the same Availability Zone and the volume type is **io1** or **io2**.

  * You can attach one EBS volume to up to 16 EC2 instances at once.
  * All instances see the same block device, which means they can read from or write to the same volume.
  * It is designed for high-availability applications like clustered databases or shared file systems.

#### Lab Feature:

* This lab shows how to configure Amazon EBS Multi-Attach to share a single volume between two EC2 instances. You'll mount the volume as read-write on one instance and read-only on the other to safely share files. It demonstrates proper use of ext4 with Multi-Attach and best practices to avoid data corruption.

#### Benefits:

* Enables shared storage access across multiple EC2 instances in the same AZ.
* Supports high availability and failover scenarios with shared data.
* Demonstrates safe use of ext4 file system with Multi-Attach by controlling read/write access.
* Helps monitor and share files in real-time without data corruption risks.

### Architecture Diagram

<img src="https://mintcdn.com/ip-cloud-architect-pathway/oxQB-cOOz3CtgDrS/images/labs/ebs-multi-attach/001.png?fit=max&auto=format&n=oxQB-cOOz3CtgDrS&q=85&s=65584d2c4876863c4744642e3b74e0b9" alt="" width="1810" height="830" data-path="images/labs/ebs-multi-attach/001.png" />

### Task Details

1. Sign in to the AWS Management Console.
2. Launch an EC2 Instances
3. Create New EBS Volume
4. Mounting an EBS Volume in Linux

### Launching Lab Environment

1. To launch the lab environment, click on the **Start Lab** button.
2. Please wait until the cloud environment is provisioned. It will take less than a minute to provision.
3. Once the Lab is started, you will be provided with **IAM username, Password, Access Key,** and **Secret Access Key**.

> **Note:** You can only start one lab at any given time.

## Lab guide

### Lab Steps

#### Task 1: Sign in to AWS Management Console

1. Click on the **Open Console** button, and you will get redirected to AWS Console in a new browser tab.
2. On the AWS sign-in page,

   * Leave the **Account ID** as default. Never edit/remove the 12 digit Account ID present in the AWS Console. otherwise, you cannot proceed with the lab.
   * Now copy your **User Name** and **Password** in the Lab Console to the **IAM Username and Password** in AWS Console and click on the **Sign in** button.
3. Once Signed In to the AWS Management Console, Make the default AWS Region as **US East (N. Virginia) us-east-1**.

#### Task 2: Launch an EC2 Instances

1. Ensure you are in the **US East (N. Virginia) us-east-1** Region to begin launching an EC2 instance in the Amazon cloud.

2. Navigate to **EC2** by clicking on the **Services** menu in the top, then click on **EC2** in the **Compute** section.

3. Click on the **Instances** option on the left panel, and then click on the **Launch Instances** button.

4. Name : Enter **EC2Server**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/oxQB-cOOz3CtgDrS/images/labs/ebs-multi-attach/002.png?fit=max&auto=format&n=oxQB-cOOz3CtgDrS&q=85&s=f74606a27c18fe669a67af4a667edbc5" alt="" width="1600" height="245" data-path="images/labs/ebs-multi-attach/002.png" />

5. Select **Amazon Linux 2023 AMI** from the dropdown.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/oxQB-cOOz3CtgDrS/images/labs/ebs-multi-attach/003.png?fit=max&auto=format&n=oxQB-cOOz3CtgDrS&q=85&s=d58acf471a7405cf05ca04fe8676637a" alt="" width="1215" height="652" data-path="images/labs/ebs-multi-attach/003.png" />

> **Note:** If there are two AMI's present for Amazon Linux 2o23 kernel-6.1 AMI.

6. An instance type in AWS refers to a virtual server configuration that determines the computing resources, such as CPU, memory, and storage, available to an instance. It is the basic building block for creating an EC2 instance in the AWS cloud.

* For Instance Type: Select **t3.micro**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/oxQB-cOOz3CtgDrS/images/labs/ebs-multi-attach/004.png?fit=max&auto=format&n=oxQB-cOOz3CtgDrS&q=85&s=542c5e9c0258f5c4570b7e697d230d8a" alt="" width="1600" height="317" data-path="images/labs/ebs-multi-attach/004.png" />

* **t3.micro** is an instance type in AWS that comes with 2 vCPU, and 1GB memory and is suitable for low-traffic web servers, small development environments, and other lightweight applications.

7. AWS **Key pair** is a secure pair of keys used for login and access to EC2 instances. It includes a public key placed on the instance and a private key kept on the user's local computer, used for authentication to prevent unauthorized access.

* For **Key pair(login):** Select **Create a new key pair** Button
* Key pair name: **WhizKey**
* Key pair type: **RSA**
* Private key file format: **.pem**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/oxQB-cOOz3CtgDrS/images/labs/ebs-multi-attach/005.png?fit=max&auto=format&n=oxQB-cOOz3CtgDrS&q=85&s=7b1974e7b4b1e96bec90f0c90151c09b" alt="" width="620" height="619" data-path="images/labs/ebs-multi-attach/005.png" />

8. Click the Edit button in the network settings.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/oxQB-cOOz3CtgDrS/images/labs/ebs-multi-attach/006.png?fit=max&auto=format&n=oxQB-cOOz3CtgDrS&q=85&s=ac1f4addc984d0f456cc421e1810761c" alt="" width="970" height="625" data-path="images/labs/ebs-multi-attach/006.png" />

* Select the **default VPC** and a **subnet** in the **us-east-1** region. **Enable Auto-assign public IP**, choose **Create security group**, and give name as **SSH\_SG** and description as **Security Group for SSH**. And leave everything as default.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/oxQB-cOOz3CtgDrS/images/labs/ebs-multi-attach/007.png?fit=max&auto=format&n=oxQB-cOOz3CtgDrS&q=85&s=ba8076f5aaf232affb5cea017b260b47" alt="" width="956" height="583" data-path="images/labs/ebs-multi-attach/007.png" />

9. At the top right, set the Number of instances to **2**, then click Launch instance.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/oxQB-cOOz3CtgDrS/images/labs/ebs-multi-attach/008.png?fit=max&auto=format&n=oxQB-cOOz3CtgDrS&q=85&s=bd1689e3dc3a7e8a33d8f47c8652d027" alt="" width="1032" height="1430" data-path="images/labs/ebs-multi-attach/008.png" />

10. After creating the EC2 instances, rename the first instance from **EC2server** to ‘**EC2server-1**' and the second instance from '**EC2server**' to '**EC2server-2**'.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/oxQB-cOOz3CtgDrS/images/labs/ebs-multi-attach/009.png?fit=max&auto=format&n=oxQB-cOOz3CtgDrS&q=85&s=a32600f5c554cf4d2aab3b7dc3858b9c" alt="" width="1214" height="181" data-path="images/labs/ebs-multi-attach/009.png" />

#### Task 3 : Create New EBS Volume

1. In the EC2 sidebar panel, click **Volumes** to **create a new volume**.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/oxQB-cOOz3CtgDrS/images/labs/ebs-multi-attach/010.png?fit=max&auto=format&n=oxQB-cOOz3CtgDrS&q=85&s=d5e35b8c30d06a0c13b12a198fcbabcc" alt="" width="1458" height="294" data-path="images/labs/ebs-multi-attach/010.png" />

2. Set the following values in the **Create volume** form:

* **Volume type:** Provisioned IOPS SSD (io1)
* **Size (GiB):** 4
* **IOPS:** 100
* **Availability Zone:** us-east-1a
* **You must check** the box for **Enable Multi-Attach** before proceeding.
* Leave other settings as default, then click **Create Volume**.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/oxQB-cOOz3CtgDrS/images/labs/ebs-multi-attach/011.png?fit=max&auto=format&n=oxQB-cOOz3CtgDrS&q=85&s=b83c32cec4b5b819e403e45075f27c92" alt="" width="741" height="574" data-path="images/labs/ebs-multi-attach/011.png" />

3. After creating the volume and EC2 instances:

* Now, Select the newly created volume.
* Click **Actions** and then choose **Attach volume**.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/oxQB-cOOz3CtgDrS/images/labs/ebs-multi-attach/012.png?fit=max&auto=format&n=oxQB-cOOz3CtgDrS&q=85&s=36107feab02d3ba557f6c651ec144467" alt="" width="1217" height="403" data-path="images/labs/ebs-multi-attach/012.png" />

* In the **Instance** field, choose **EC2server-1**,  choose Device name “ /dev/sdf **”** then click Attach.
* Repeat the same process to attach the same volume to **EC2server-2**.
* Make sure the volume is in the same **Availability Zone (us-east-1a)** as both instances.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/oxQB-cOOz3CtgDrS/images/labs/ebs-multi-attach/013.png?fit=max&auto=format&n=oxQB-cOOz3CtgDrS&q=85&s=059b8563442104b0dceee387fef8b291" alt="" width="1449" height="623" data-path="images/labs/ebs-multi-attach/013.png" />

<img src="https://mintcdn.com/ip-cloud-architect-pathway/oxQB-cOOz3CtgDrS/images/labs/ebs-multi-attach/014.png?fit=max&auto=format&n=oxQB-cOOz3CtgDrS&q=85&s=507b0ecdf86d0b76a89a66ffe44a31a5" alt="" width="1437" height="620" data-path="images/labs/ebs-multi-attach/014.png" />

#### Task 4 : Mounting an EBS Volume in Linux

1. Now, Navigate to EC2 Instance, Use **EC2 Instance Connect** to access and establish a connection between **EC2Server-1** and **EC2Server-2** via the browser.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/oxQB-cOOz3CtgDrS/images/labs/ebs-multi-attach/015.png?fit=max&auto=format&n=oxQB-cOOz3CtgDrS&q=85&s=53b9ae5b732aa616c415997468c7c80e" alt="" width="1221" height="199" data-path="images/labs/ebs-multi-attach/015.png" />

<img src="https://mintcdn.com/ip-cloud-architect-pathway/oxQB-cOOz3CtgDrS/images/labs/ebs-multi-attach/016.png?fit=max&auto=format&n=oxQB-cOOz3CtgDrS&q=85&s=a78d54c4275a4d51d0090c71dc39230e" alt="" width="1441" height="591" data-path="images/labs/ebs-multi-attach/016.png" />

2. On Both EC2s, Check and Identify the EBS Volume :

```
lsblk
```

* Look for the EBS volume. It should show up as follow,

<img src="https://mintcdn.com/ip-cloud-architect-pathway/oxQB-cOOz3CtgDrS/images/labs/ebs-multi-attach/017.png?fit=max&auto=format&n=oxQB-cOOz3CtgDrS&q=85&s=630f012020c40d3d27b08642491ff4df" alt="" width="1230" height="712" data-path="images/labs/ebs-multi-attach/017.png" />

3. On EC2Server-1 (Writer) — Format, Mount, Write paste and run the following command:

```
# Format the volume (only on one instance, only once!)
sudo mkfs.ext4 /dev/nvme1n1

# Create mount point
sudo mkdir -p /mnt/shared

# Mount the volume
sudo mount /dev/nvme1n1 /mnt/shared

# Create a test file
echo "Hello from Instance A" | sudo tee /mnt/shared/test.txt

# Confirm it was written
cat /mnt/shared/test.txt
```

<img src="https://mintcdn.com/ip-cloud-architect-pathway/oxQB-cOOz3CtgDrS/images/labs/ebs-multi-attach/018.png?fit=max&auto=format&n=oxQB-cOOz3CtgDrS&q=85&s=323579a43f00ce4815a155932dd44f17" alt="" width="1560" height="1148" data-path="images/labs/ebs-multi-attach/018.png" />

4. On EC2server-2 (Reader) — Mount as Read-Only paste and run the following command:

```
# Create mount point
sudo mkdir -p /mnt/shared

# Mount the volume read-only to prevent corruption
sudo mount -o ro /dev/nvme1n1 /mnt/shared

# Try to read the file
cat /mnt/shared/test.txt

# You should see:
# “Hello from Instance A”
```

<img src="https://mintcdn.com/ip-cloud-architect-pathway/oxQB-cOOz3CtgDrS/images/labs/ebs-multi-attach/019.png?fit=max&auto=format&n=oxQB-cOOz3CtgDrS&q=85&s=6737ee5ea1c75ac263caa2928a3f99f4" alt="" width="1404" height="1532" data-path="images/labs/ebs-multi-attach/019.png" />

> ##### Do You Know?
>
> EBS Multi-Attach is a feature that allows a single Amazon EBS volume to be attached to multiple EC2 instances at the same time within the same Availability Zone. This is useful when you want several instances to access the same data — like for high availability or shared storage systems.

### Completion & Conclusion

* You have successfully launched **two EC2 Instances**
* You have successfully created an **EBS volume**
* You have attached the **Multi-attach enabled EBS volume** to multiple EC2 instances.
* You have **formatted and mounted the EBS volume** on both instances.
* You have verified that **Instance B can read the file created by Instance A**.

### End Lab

1. Sign out of AWS Account.
2. You have successfully completed the lab.
3. Once you completed the steps, click on **End Lab** from your IP Lab Portal and wait till the process gets completed.

## What gets checked

When you press **Check my work**, the platform verifies each of these:

* **Create EBS Volume** — Check whether an EBS volume is created.
* **Launch an EC2 Instance** — Check whether an EC2 Instance is launched or not.
* **Launch EC2 AMI type Amazon Linux** — Check whether the EC2 instance is launched using an Amazon AMI.

## Related help

* [FAQs and Troubleshooting](/aws-saa/support/faqs-and-troubleshooting)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.