Description
An EBS-backed AMI stores its data in snapshots. Check the encryption state of each snapshot that backs the image.
Potential impact
Application data and configuration in unencrypted snapshots may fail an encryption-at-rest requirement. AMI and snapshot sharing permissions also need separate review.
Remediation
Creating an AMI from an instance preserves the volumes’ encryption state. To migrate an unencrypted AMI, make an encrypted copy, check its snapshots and use the copied AMI ID for new deployments.
Examples
The first task creates an image from the specified instance. The second encrypts a copy of the AMI identified by source_ami_id and source_region in target_region. Both use newtest. If you copy the first AMI in the same account and Region, give the copy a different name.
Before
- name: Basic AMI Creation
amazon.aws.ec2_ami:
instance_id: i-xxxxxx
wait: yes
name: newtest
After
- name: Copy AMI with encryption
community.aws.ec2_ami_copy:
source_image_id: "{{ source_ami_id }}"
source_region: "{{ source_region }}"
region: "{{ target_region }}"
encrypted: true
wait: true
name: newtest