Review EC2 EBS optimization

Choose EBS optimization for the instance type and I/O requirements.

Description

EBS optimization reduces contention between storage I/O and other traffic. Some instance types enable it by default, some support it optionally, and others do not support it; an omitted EbsOptimized value alone does not establish that it is disabled.

Potential impact

On a type that needs optional optimization, leaving it disabled can result in storage I/O below expected performance.

Remediation

Check the instance type’s support and defaults. Where optionally supported and needed, set EbsOptimized: true and assess instance and volume throughput together with cost.

Examples

Supply an InstanceType supporting optional EBS optimization and a compatible AmiId. Types optimized by default do not need this change. Adapt the key and remaining deployment settings to the environment.

Before

yaml
Resources:
  MyEC2Instance:
    Type: AWS::EC2::Instance
    Properties:
      ImageId: !Ref AmiId
      InstanceType: !Ref InstanceType
      KeyName: "testkey"
      BlockDeviceMappings:
        - DeviceName: "/dev/sdm"
          Ebs:
            VolumeType: "io1"
            Iops: "200"
            DeleteOnTermination: "false"
            VolumeSize: "20"

After

yaml
Resources:
  MyEC2Instance:
    Type: AWS::EC2::Instance
    Properties:
      ImageId: !Ref AmiId
      InstanceType: !Ref InstanceType
      KeyName: "testkey"
      BlockDeviceMappings:
        - DeviceName: "/dev/sdm"
          Ebs:
            VolumeType: "io1"
            Iops: "200"
            DeleteOnTermination: "false"
            VolumeSize: "20"
      EbsOptimized: true

References