Closed rosscdh closed 2 years ago
Files identified in the description: None
If these files are inaccurate, please update the component name
section of the description or use the !component
bot command.
Hi @rosscdh, Thank you for opening this issue.
I tried a couple of example tasks that make use of a snapshot_id
to attach the volume from a snapshot while spinning up the new instances.
The below seem to work as expected, could you please try using something like this to see if it works for your case.
- name: Create a test instances with snapshot volumes attached to it
tasks:
- name: start single instance
amazon.aws.ec2_instance:
name: "test-instance"
vpc_subnet_id: subnet-xxxxxxxxx
instance_type: t3.small
image_id: ami-00399xxxxxxxxx
volumes:
- device_name: /dev/sda2
ebs:
snapshot_id: snap-0xxxxxxxx
- name: start multiple instances
amazon.aws.ec2_instance:
name: "test-instance-{{ item }}"
vpc_subnet_id: subnet-xxxxxxxxx
instance_type: t3.small
image_id: ami-00399xxxxxxxxx
volumes:
- device_name: /dev/sda2
ebs:
snapshot_id: snap-0xxxxxxxx
with_items: [1,2,3]
Summary
When trying to spin up a set of ec2 instances; we need to use a snapshot as a volume attachment
the amazon.aws.ec2 module supports attaching a snapshot id but not kms_id and the newer amazon.aws.ec2_instance does not seem to support snapshot_id but does support kms_id
How does one spin up new instances with an attached volume from a snapshot?
Issue Type
Bug Report
Component Name
amazon.aws.ec2_instance
Ansible Version
Collection Versions
AWS SDK versions
Configuration
OS / Environment
osx
Steps to Reproduce
Expected Results
an ec2 instance spins up with a volume from a snapshot_id
Actual Results
Code of Conduct