Reputation: 21
I want to create a EC2 instance using knife with an elastic IP assigned to it. Knife has the option --associate-eip
but when I use this option it fails with error
ERROR: Elastic IP requested is not available.
even though the EIP in AWS console shows the IP is available.
The command I executed
knife ec2 server create -S testKey -I ami-e7b8c0d7 --security-group-id test_sg -N test-eip -f m3.medium --region us-west-2 -i testKey.pem --associate-eip 6.6.6.6
Did I miss any obvious steps? Where does knife look for the elastic ip list? Is there a place to inform about the elastic IP list to knife?
Upvotes: 1
Views: 174
Reputation: 21
After adding the --subnet
attribute with the default subnet id of that region and adding --server-connect-attribute public_ip_address
, its possible to create instances with eip assigned.
knife ec2 server create -N test-eip -I ami-e7b8c0d7 --security-group-id sg-685a00d -f m3.medium --region us-west-2 --ssh-user ubuntu -S testKey -i key.pem --associate-eip 6.6.6.6 --subnet --server-connect-attribute public_ip_address
To find the default subnetid of the region, launch the instance and in the "Configure Instance Details" take subnet id that is displayed.
Upvotes: 1