I am trying to use the ec2_instance module to create an ec2 instance. When using the ec2 module to configure a volume one would do something like this:
With ec2_instance I am not sure how to set the values.
In the description it says:
A list of block device mappings, by default this will always use the AMI root device so the volumes option is primarily for adding more storage.
A mapping contains the (optional) keys device_name, virtual_name, ebs.device_type, ebs.device_size, ebs.kms_key_id, ebs.iops, and ebs.delete_on_termination.
Please let me know how I would set the info from above example using the ec2_instance module.
You may need to specify /dev/sda1 still, if you want to attach a larger root volume than the AMI provides, or a volume with characteristics the default volume does not have.
Well, I don’t know what I was looking at, but now there ARE ec2_instance examples. I haven’t checked them out beyond noting that at least they are not ec2_instance_facts examples
Maybe I was looking at older documentation.
As soon as I logged into github I found the previous bug report on this issue.
when you are checking module documentation, make sure you match the correct ansible version. For example, latest https://docs.ansible.com/ansible/latest/modules/modules_by_category.html you can change the latest part to 2.4, 2.5, 2.6, or devel. Sometimes the documentation changes so the path in the url might be different but, for the most part this works.
I have free account so only default instances can be created but I changed Root Password To Root before starting so there should not be permission issue but it gives me an permission issue.
Your issue seems to be more an issue about connecting right to the aws vm than ansible. Did you create the keys, downloaded them, ssh-add and connecting as the right user? are you using -K and escalating correctly?
"permission denied"is good! It means that you do have network connectivity to the instance. It also means that either the username OR the private key (OR both are incorrect.
Turn on all the debugging you can find in putty, try connecting again, and post the debug output here.
I’m puzzled. How did you download the .pem file onto an instance you have no access to?
There are two parts to a key pair in AWS.
The PUBLIC part will be placed on the instance by AWS as it is created, as an entry in ~ubuntu/.ssh/authorized_keys
The PRIVATE part will be offered to you for download when you create it - whether you create it using the CLI, an API or the Console. That PRIVATE part will be called something.pem.
Please confirm that the .pem file offered to you when you created the keypair is on the remote server - that you have no access to.
If you really have no access to the server the .pem file is on, you will be unable to access the instance without going through a relatively complicated recovery process. It’s generally simpler to create a new instance.
Actually I opened powershell in windows and copy the content (which was easy) then I vi and pasted it in .ssh folder with same name and .pem extension that’s it.
But that config file you told me to create I put an public IP as HostName also the last line IdentityFile I don’t understand. So still confused what’s an missing argument?