For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/ansible-aws-launch-configuration-is-not-encrypted.md.
A documentation index is available at /llms.txt.
Block device volumes in EC2 launch configurations must be encrypted to protect data at rest and prevent exposure of snapshots or AMIs if storage media is compromised.
For Ansible tasks using the community.aws.autoscaling_launch_config or autoscaling_launch_config modules, ensure the volumes list is defined and each volume entry sets encrypted: true (Ansible yes is also acceptable) under ec2_lc.volumes. Ephemeral (instance-store) volumes do not support encryption and are excluded. This rule flags launch configurations missing the volumes property, any volume entries without an encrypted property, or volumes where encrypted is explicitly false.
Example secure configuration for an Ansible autoscaling_launch_config task:
- name:Create launch configuration with encrypted volumescommunity.aws.autoscaling_launch_config:name:my-launch-configimage_id:ami-0123456789abcdef0instance_type:t3.mediumvolumes:- device_name:/dev/xvdavolume_size:50volume_type:gp2encrypted:truedelete_on_termination:yes
Compliant Code Examples
- name:note that encrypted volumes are only supported in >= Ansible 2.4 v4community.aws.autoscaling_launch_config:name:specialimage_id:ami-XXXkey_name:defaultsecurity_groups:[group, group2]instance_type:t1.microvolumes:- device_name:/dev/sda1volume_size:100volume_type:io1iops:3000delete_on_termination:trueencrypted:yes- name:note that encrypted volumes are only supported in >= Ansible 2.4 v5community.aws.autoscaling_launch_config:name:specialimage_id:ami-XXXkey_name:defaultsecurity_groups:[group, group2]instance_type:t1.microvolumes:- device_name:/dev/sda1volume_size:100volume_type:io1iops:3000delete_on_termination:trueencrypted:yes
Non-Compliant Code Examples
- name:note that encrypted volumes are only supported in >= Ansible 2.4community.aws.autoscaling_launch_config:name:specialimage_id:ami-XXXkey_name:defaultsecurity_groups:['group','group2']instance_type:t1.microvolumes:- device_name:/dev/sda1volume_size:100volume_type:io1iops:3000delete_on_termination:trueencrypted:no- name:note that encrypted volumes are only supported in >= Ansible 2.4 v2community.aws.autoscaling_launch_config:name:specialimage_id:ami-XXXkey_name:defaultsecurity_groups:['group','group2']instance_type:t1.microvolumes:- device_name:/dev/sda1volume_size:100volume_type:io1iops:3000delete_on_termination:true- name:note that encrypted volumes are only supported in >= Ansible 2.4 v3community.aws.autoscaling_launch_config:name:specialimage_id:ami-XXXkey_name:defaultsecurity_groups:['group','group2']instance_type:t1.micro
1
2
rulesets:- Ansible / AWS # Rules to enforce / AWS.
Request a personalized demo
Get Started with Datadog
Ask AI
AI-generated responses may be inaccurate. Verify important info.