Creating AMI's from EBS backed instances is exceedingly easy, but doing the same from an instance-store based instance seems like it can only be done manually using the CLI.
So far I've been able to bootstrap the creation of an 'instance-store' based server off of an HVM Amazon Linux AMI with Ansible, but I'm getting lost on the steps that follow... I'm trying to follow this: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-instance-store-ami.html#amazon_linux_instructions
Apparently I need to store my x.509 cert and key on the instance, but which key is that? Is that...
- one I have to generate on the instance with openssl,
- one that I generate/convert from AWS,
- one I generate with Putty, or
- one that already exists in my AWS account?
After that, I can't find any reference to ec2-bundle-vol
in Ansible. So I'm left wondering if the only way to do this is with Ansible's command
module.
Basically what I'm hoping to find out is: Is there a way to easily create instance-store
based AMI's using Ansible, and if not, if anyone can reference the steps necessary to automate this? Thanks!
Generally speaking, Ansible AWS modules are meant to manage AWS resources by interacting with AWS HTTP API (ie. actions you could otherwise do in the AWS Management Console).
They are not intended to run AWS specific system tools on EC2 instances.
ec2-bundle-vol
andec2-upload-bundle
must be run on the EC2 instance itself. It is not callable via the HTTP API.I'm afraid you need to write a custom playbook / role to automate the process.
On the other hand,
aws ec2 register-image
is an AWS API call and correspond to theec2_ami
Ansible module. Unfortunately, this module doesn't seem to support image registering from an S3 bucket.