Attaching a volume to multiple instances with Amazon EBS Multi-Attach - Amazon Elastic Compute Cloud

Attaching a volume to multiple instances with Amazon EBS Multi-Attach

Amazon EBS Multi-Attach enables you to attach a single Provisioned IOPS SSD (io1) volume to up to 16 Nitro-based 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.

Features

Multi-Attach enabled volumes support many of the features that are supported by regular Amazon EBS volumes, including:

Considerations and limitations

  • 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) volumes.

  • Multi-Attach is available in the us-east-1, us-west-2, eu-west-1, 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 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.

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 io1 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.

Working 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.

Enabling Multi-Attach

You can enable Multi-Attach for an Amazon EBS volume during creation only.

Use one of the following methods to enable Multi-Attach for an Amazon EBS volume during creation.

Console

To enable Multi-Attach during volume creation

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the navigation pane, choose Volumes.

  3. Choose Create Volume.

  4. For Volume Type, choose Provisioned IOPS SSD (io1).

  5. For Size and IOPS, choose the required volume size and the number of IOPS to provision.

  6. For Availability Zone, choose the same Availability Zone that the instances are in.

  7. For Multi-Attach, choose Enable.

  8. Choose Create Volume.

Command line

To enable Multi-Attach during volume creation

Use the create-volume command and specify the --multi-attach-enabled parameter.

$ aws ec2 create-volume --volume-type io1 --multi-attach-enabled --size 100 --iops 2000 --region us-west-2 --availability-zone us-west-2b

Attaching a volume to instances

You attach a Multi-Attach enabled volume to an instance in the same way that you attach a regular volume. For more information, see Attaching an Amazon EBS volume to an instance.

Deleting 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 Preserving 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 } } ]

Monitoring

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) volumes. For more information, see Amazon EBS pricing.