Last updated on February 22, 2023
Amazon Elastic Block Store or EBS is a durable block-based storage device that can be attached to your EC2 instance. AWS released a feature called Multi-Attach, which allows EC2 instances to share a single EBS volume for up to 16 instances and provide higher availability of your applications for Linux workloads. Each instance to which the volume is attached has full read and write permissions to the volume.
The following are several considerations and limitations in using the Multi-Attach feature:
- Multi-Attach enabled volumes do not support I/O fencing. I/O fencing protocols control write access in a shared storage environment to maintain data consistency. Your applications must provide write ordering for the attached instances to maintain data consistency.
- Multi-Attach enabled volumes can be attached to up to 16 instances built on the Nitro System that are in the same Availability Zone.
- Multi-Attach is supported exclusively on Provisioned IOPS SSD (io1 or io2) volumes.
- Multi-Attach for io1 volumes is available in the us-east-1, us-west-1, us-west-2, and ap-northeast-2 Regions.
- Multi-Attach enabled volumes can’t be created as boot volumes.
- Multi-Attach enabled volumes can be attached to one block device mapping per instance.
- You can’t enable or disable Multi-Attach after volume creation.
- You can’t change the volume type, size, or Provisioned IOPS of a Multi-Attach enabled volume.
- Multi-Attach can’t be enabled during instance launch using either the Amazon EC2 Console or the RunInstances API.
- Multi-Attach enabled volumes that have an issue at the Amazon EBS infrastructure layer are unavailable to all attached instances. Issues at the Amazon EC2 or networking layer might only impact some attached instances.
Getting started with EBS Multi-Attach
- Create EBS Volume
- Head over to EC2 and look for “Volumes”
- Click “Create Volume”
- Volume type should be either io1 or io2 since they’re the only supported volume type
- Enter your preferred EBS and IOPS
- Availability Zones should be at the same availability zone as the EC2 instance that you will be attaching.
- Tick “Multi-Attach” to “Enable”
2. Attach Volume
-
- Select the EBS volume that you created.
- Under actions, click “Attach Volume”
- Specify the instance ID of the first EC2 instance
- Device: /dev/sdf
- Attach
- Do the same process for the second EC2 instance
3. SSH into your two EC2 instances and you should see the newly attached EBS volume. Under the volumes
tab, you can see what instances the EBS volume is attached to.
Delete on termination
If the delete-on-termination feature is enabled on your EC2 instances, the EBS Multi-Attach volume is only deleted when the last EC2 instance to which it is attached is terminated. It is recommended that you use delete on termination on all EC2 instances or retain EBS volumes whenever their EC2 instances are terminated.
Monitoring
You can monitor your EBS Multi-Attach volume metrics using CloudWatch.
Sources:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volumes.html
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volumes-multi.html