Attach a volume to multiple instances with Amazon EBS Multi-Attach
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 applications that
manage concurrent write operations.
Contents
Considerations and limitations
-
Multi-Attach enabled volumes can be attached to up to 16 instances built on the Nitro System that are in the same Availability Zone.
-
Linux instances support Multi-Attach enabled
io1
andio2
volumes. Windows instances support Multi-Attach enabledio2
volumes only. -
The maximum number of Amazon EBS volumes that you can attach to an instance depends on the instance type and instance size. For more information, see instance volume limits.
-
Multi-Attach is supported exclusively on Provisioned IOPS SSD (io1 and io2) volumes.
-
Multi-Attach for
io1
volumes is available in the following Regions only: US East (N. Virginia), US West (Oregon), and Asia Pacific (Seoul).Multi-Attach for
io2
is available in all Regions that supportio2
.Note
For better performance, consistency, and durability at a lower cost, we recommend that you use
io2
volumes. -
io1
volumes with Multi-Attach enabled are not supported with instances built on the Nitro System that support the Scalable Reliable Datagram (SRD) networking protocol only. To use Multi-Attach with these instance types, you must useio2
Block Express volumes. -
Standard file systems, such as XFS and EXT4, are not designed to be accessed simultaneously by multiple servers, such as EC2 instances. You should use a clustered file system to ensure data resiliency and reliability for your production workloads.
-
Multi-Attach enabled
io2
volumes 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. For more information, see NVMe reservations.Multi-Attach enabled
io1
volumes do not support I/O fencing. -
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.
-
Multi-Attach can't be enabled during instance launch using either the Amazon EC2 console or 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 impact only some attached instances.
-
The following table shows volume modification support for Multi-Attach enabled
io1
andio2
volumes after creation.io2
volumesio1
volumesModify volume type ✗ ✗ Modify volume size ✓ ✗ Modify provisioned IOPS ✓ ✗ Enable Multi-Attach ✓ * ✗ Disable Multi-Attach ✓ * ✗ * You can't enable or disable Multi-Attach while the volume is attached to an instance.
Performance
Each attached instance is able to drive its maximum IOPS performance up to the volume's maximum provisioned performance. However, the aggregate performance of all of the attached instances can't exceed the volume's maximum provisioned performance. If the attached instances' demand for IOPS is higher than the volume's Provisioned IOPS, the volume will not exceed its provisioned performance.
For example, say you create an io2
Multi-Attach enabled volume with
80,000
provisioned IOPS and you attach it to an m7g.large
instance that supports up to 40,000
IOPS, and an r7g.12xlarge
instance that supports up to 60,000
IOPS. Each instance can drive its
maximum IOPS as it is less than the volume's Provisioned IOPS of 80,000
.
However, if both instances drive I/O to the volume simultaneously, their combined
IOPS can't exceed the volume's provisioned performance of 80,000
IOPS.
To achieve consistent performance, it is best practice to balance I/O driven from attached instances across the sectors of a Multi-Attach enabled volume.
Work with Multi-Attach
Multi-Attach enabled volumes can be managed in much the same way that you would manage any other Amazon EBS volume. However, in order to use the Multi-Attach functionality, you must enable it for the volume. When you create a new volume, Multi-Attach is disabled by default.
Enable Multi-Attach
You can enable Multi-Attach during volume creation. Use one of the following methods.
You can also enable Multi-Attach for io2
volumes after creation, but only if they
are not attached to any instances.
Note
You can't enable Multi-Attach for io1
volumes after creation.
Use one of the following methods to enable Multi-Attach for an io2
volume after creation.
Disable Multi-Attach
You can disable Multi-Attach for an io2
volume only if it is attached to no more than
one instance.
Note
You can't disable Multi-Attach for io1
volumes after creation.
Use one of the following methods to disable Multi-Attach for an io2
volume.
Attach a volume to instances
You attach a Multi-Attach enabled volume to an instance in the same way that you attach any other EBS volume. For more information, see Attach an Amazon EBS volume to an instance.
Delete on termination
Multi-Attach enabled volumes are deleted on instance termination if the last attached instance is terminated and if that instance is configured to delete the volume on termination. If the volume is attached to multiple instances that have different delete on termination settings in their volume block device mappings, the last attached instance's block device mapping setting determines the delete on termination behavior.
To ensure predictable delete on termination behavior, enable or disable delete on termination for all of the instances to which the volume is attached.
By default, when a volume is attached to an instance, the delete on termination setting for the block device mapping is set to false. If you want to turn on delete on termination for a Multi-Attach enabled volume, modify the block device mapping.
If you want the volume to be deleted when the attached instances are terminated, enable delete on termination in the block device mapping for all of the attached instances. If you want to retain the volume after the attached instances have been terminated, disable delete on termination in the block device mapping for all of the attached instances. For more information, see Preserve data when an instance is terminated.
You can modify an instance's delete on termination setting at launch or after it has launched. If you enable or disable delete on termination during instance launch, the settings apply only to volumes that are attached at launch. If you attach a volume to an instance after launch, you must explicitly set the delete on termination behavior for that volume.
You can modify an instance's delete on termination setting using the command line tools only.
To modify the delete on termination setting for an existing instance
Use the
modify-instance-attribute command and specify the DeleteOnTermination
attribute in the --block-device-mappings option
.
aws ec2 modify-instance-attribute --instance-id
i-1234567890abcdef0
--block-device-mappings file://mapping.json
Specify the following in mapping.json
.
[ { "DeviceName": "
/dev/sdf
", "Ebs": { "DeleteOnTermination":true|false
} } ]
Monitor a Multi-Attach enabled volume
You can monitor a Multi-Attach enabled volume using the CloudWatch Metrics for Amazon EBS volumes. For more information, see Amazon CloudWatch metrics for Amazon EBS.
Data is aggregated across all of the attached instances. You can't monitor metrics for individual attached instances.
Pricing and billing
There are no additional charges for using Amazon EBS Multi-Attach. You are billed the standard charges that
apply to Provisioned IOPS SSD (io1
and io2
) volumes. For more information,
see Amazon EBS pricing