Review EC2 EBS optimization settings

Check instance-type defaults and the workload’s EBS performance requirements.

Description

EBS optimization provides dedicated bandwidth between EC2 and its EBS volumes. The instance type determines what happens when you omit ebs_optimized.

Potential impact

Storage traffic competing for bandwidth can slow applications. Requesting optimization on an unsupported type can prevent launch.

Remediation

Check whether the type enables optimization by default or offers it as an option. If the workload needs the optional feature, set ebs_optimized: true. Review cost and performance limits, then measure throughput and latency after the change.

Examples

These tasks use the legacy amazon.aws.ec2 module. Supply a type with optional optimization for ebs_instance_type, a compatible AMI for ec2_image_id, and your own key pair, security groups, and subnet.

Before

yaml
- name: example
  amazon.aws.ec2:
    key_name: mykey
    instance_type: "{{ ebs_instance_type }}"
    image: "{{ ec2_image_id }}"
    wait: yes
    group: default
    count: 3
    vpc_subnet_id: subnet-29e63245

After

yaml
- name: example
  amazon.aws.ec2:
    key_name: mykey
    instance_type: "{{ ebs_instance_type }}"
    image: "{{ ec2_image_id }}"
    wait: yes
    group: my_sg
    count: 3
    vpc_subnet_id: subnet-29e63245
    ebs_optimized: true

Each task is a separate launch of three instances. Running the After task as well can launch three more, using my_sg instead of default.

References