I’m trying to attach an elastic IP to an instance in a VPC, but despite following what seem to be working examples in online documentation, I’m getting an error.
To keep it as simple as possible, I have:
-
Launched an instance (using Ansible) in a public VPC subnet
-
Manually captured its ID
-
Created an elastic IP (using Ansible)
-
Manually captured its ID
I’ve then placed these two into the following:
- ec2_eip:
in_vpc: yes
aws_access_key: “{{ aws_access_key }}”
aws_secret_key: “{{ aws_secret_key }}”
region: “{{ aws_region }}”
ip: 176.34.177.168
device_id: i-017a9496dc9940cd1
The output I get is:
fatal: [localhost]: FAILED! => {“changed”: false, “failed”: true, “msg”: “EC2ResponseError: 400 Bad Request\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\nInvalidParameterCombination
You must specify an allocation id when mapping an address to a VPC instance14ea5e22-0e38-4392-90bc-48c1837f4a46”}
I get the same behaviour when I tie the above tasks together with register and facts.
Having scoured the documentation, mailing lists, online books, and other Google resources, I can’t see that I am doing anything wrong.
What am I missing?
My system:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial
$ ansible --version
ansible 2.3.1.0
config file =
configured module search path = Default w/o overrides
python version = 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609]
S.