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 clustered Linux
applications that manage concurrent write operations.
Contents
Considerations and limitations
-
Multi-Attach enabled volumes can be attached to up to 16 Linux instances built on the Nitro System that are in the same Availability Zone. You can attach a volume that is Multi-Attach enabled to Windows instances, but the operating system does not recognize the data on the volume that is shared between the instances, which can result in data inconsistency.
-
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 (N. California), US West (Oregon), and Asia Pacific (Seoul).Multi-Attach for
io2
andio2
Block Express volumes is available in all Regions that support those volumes types. -
You can't attach a Multi-Attach enabled
io2
volume to instance types that support Block Express and instance types that do not support Block Express at the same time. For more information, see io2 Block Express volumes. -
io1
volumes with Multi-Attach enabled are not supported with instance types that support io2 Block Express. To use Multi-Attach with these instance types, you must use io2 volumes. -
Standard file systems, such as XFS and EXT4, are not designed to be accessed simultaneously by multiple servers, such as EC2 instances. Using Multi-Attach with a standard file system can result in data corruption or loss, so this is not safe for production workloads. You can use a clustered file system to ensure data resiliency and reliability for production workloads.
-
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'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
50,000
Provisioned IOPS and you attach it to an m5.8xlarge
instance and a c5.12xlarge
instance. The m5.8xlarge
and c5.12xlarge
instances support a maximum of 30,000
and 40,000
IOPS respectively. Each instance can drive its maximum IOPS
as it is less than the volume's Provisioned IOPS of 50,000
. However, if
both instances drive I/O to the volume simultaneously, their combined IOPS can't exceed
the volume's provisioned performance of 50,000
IOPS. The volume will
not exceed 50,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 for io1
and io2
volumes during creation.
Use one of the following methods to enable Multi-Attach for an io1
or io2
volume
during creation.
You can also enable Multi-Attach for io2
volumes after they have been created only if they are not attached to any instances.
You can't enable Multi-Attach for io1
volumes after creation.
Use one of the following methods to enable Multi-Attach for an Amazon EBS volume after it has been created.
Disable Multi-Attach
You can disable Multi-Attach for an io2
volume only if it is attached to no more than
one instance.
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 Amazon EBS volumes on instance termination.
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