user1102171
user1102171

Reputation: 684

cannot map ec2 instance to elastic ip address

trying from web console and as well through command line to associate the elastic ip to a micro instance using command:

ec2-associate-address -i <instance id> <elastic ip address>

It continuously gives error:

Client.InvalidParameterCombination: You must specify an allocation id when mapping an address to a VPC instance (Service: AmazonEC2; Status Code: 400; Error Code: InvalidParameterCombination; Request ID:

Followed the guide from:https://aws.amazon.com/articles/1346. Anyone else is facing this issue. Infact I cannot select a running instance from the screen : elastic ip --> associate address and hence web console is out of question...

thanks in advance for any clue...

Upvotes: 0

Views: 1539

Answers (2)

ceejayoz
ceejayoz

Reputation: 179994

Exactly what it says on the tin. For an instance in a VPC, you have to provide an allocation ID when you associate an address. See: Elastic IP Addresses for details.

The ec2-associate-address style calls are ancient and I believe unmaintained at this point. You should be using the newer AWS CLI.

Your issue with the console is likely not having any EIPs available for VPC use. You cannot use a non-VPC EIP in a VPC. Allocate a new EIP and make sure you select VPC when doing so.

Upvotes: 1

helloV
helloV

Reputation: 52375

For VPC, you also need to specify the allocation id of the elastic ip. You are also using old style CLI. To fix your situation, get the allocation-id of the elastic ip.

ec2-describe-addresses <elastic ip address>

This will return a eipalloc-xxxxxxxx. Now associate it with the instance.

ec2-associate-address -i <instance-id> -a <eipalloc-xxxxxxxx>

Now the IP is associated with the instance.

Upvotes: 1

Related Questions