AWS EBS Multi-Attach

Postgraduate in Communications Engineering with working experience in the Support Desk and self-study in software development.
Search for a command to run...

Postgraduate in Communications Engineering with working experience in the Support Desk and self-study in software development.
What is Amazon EBS? Amazon EBS is a block storage service that provides scalable and persistent storage volumes. They behave like raw, unformatted block devices. You can mount these volumes as devices on your EC2 instances. EBS volumes are essentiall...
The git log command is used to view the commit history of a Git repository. You can customize the output format to show specific details in a more readable or structured way. Below are some useful variations and formatting options for git log: To sh...

Overview This article will teach us how to: Install Ubuntu Server 24.04 on a laptop from scratch Install Ubuntu server by using Vagrant tool with ISO image Prerequisites: A laptop without any OS installed; A virtualization software Virtualbox t...

The /etc/passwd and /etc/shadow files are the backbone of Linux user management. Together, they store user account information and handle authentication securely. This article provides a hands-on guide to understanding these files, their structure, a...

In Linux, links are powerful tools that allow you to create references to files and directories. There are two main types of links: hard links and soft links (also known as symbolic links or symlinks). Understanding the differences between these two ...

A hostname is a human-friendly name given to a computer. It is a unique identifier that allows us to identify the machine in various network communications, making it easier to locate and manage devices. Type: hostname To see where it is stored, typ...

Amazon EBS Multi-Attach enables you to attach a single Provisioned IOPS SSD (io1 or io2) volume to multiple instances that are in the same Availability Zone. You can attach multiple Multi-Attach enabled volumes to an instance or set of instances. Each instance to which the volume is attached has full read and write permission to the shared volume. Multi-Attach makes it easier for you to achieve higher application availability in clustered Linux applications that manage concurrent write operations.
There are a few limitations to be aware of when using Amazon Elastic Block Store (EBS) Multi-Attach volumes:
Only Nitro-based EC2 instances can use Multi-Attach volumes. This means that instances launched from certain older instance types or virtualization types will not be able to use Multi-Attach volumes
Multi-Attach volumes can only be attached to instances in the same availability zone. This means that you cannot use Multi-Attach to share a volume across multiple availability zones
Multi-Attach volumes can only be attached to instances that are in the running or stopped state. You cannot attach a Multi-Attach volume to an instance that is in the terminated state
Only certain types of workloads are suitable for Multi-Attach. High-performance workloads such as databases, big data, and HPC could be designed to use Multi-attach
Multi-Attach volumes can only be used with provisioned IOPS SSD (io1) and General Purpose SSD (gp2) volumes, and not with magnetic (standard) volumes
Multi-Attach volumes are currently only available in certain regions
The maximum IOPS and throughput limits per volume are lower when using Multi-Attach compared to when using a single-attach volume
The aim of this hands-on lab is to create EBS Multi-Attach and see it in action. We will create two EC2 instances (FirstInstance and SecondInstance) and one EBS volume with Multi-Attach enabled functionality. This EBS volume will be attached to the two EC2 instances. By accessing this EBS volume from one EC2 machine, we will format it, mount and create a file demoFile. We will access this file from the second EC2 machine. Then, we will create a file secondDemoFile on the second EC2 instance and access it from the first EC2 instance.
Create an SSH key pair:

Create two EC2 instances with different AMIs: one with Ubuntu (AMI ID: ami-053b0d53c279acc90) and the second with Linux 2 (AMI ID: ami-09538990a0c4fe9be). Choose the instance type t3.small for both EC2 machines.

Then, create an EBS Multi-Attach volume:

Attach EBS Multi-Attach Volume to the two EC2 instances:

Check whether the volume was attached to the two EC2 instances:

Connect to the first EC2 instance above (FirstInstance) running Ubuntu via AWS EC2 Connect.
When the connection is established, list all available block devices on the instance to identify the block device that corresponds to your EBS volume:
lsblk
As we can see as a result of lsblk command, there is no mount point for the attached EBS volume.

Format the EBS Volume:
sudo mkfs.ext4 /dev/nvme1n1
Mount the EBS Volume:
Now, create a directory where you'll mount the volume:
sudo mkdir /mnt/myvolume
Mount the volume to this directory:
sudo mount /dev/nvme1n1 /mnt/myvolume

Connect to the second EC2 instance and identify the block device that corresponds to your EBS volume with the command lsblk.
Mount the EBS Volume:
Now, create a directory where you'll mount the volume and mount the volume to this directory:

Access the demoFile from the second EC2 instance:

Create another file secondDemoFile on the second EC2 instance:

Finally, to access secondDemoFile from the first EC2 instance, first, we need to unmount the EBS volume and mount it again to see the changes made by other instances.
