Boto allocate elastic IP

Question:

I can’t find how to allocate an elastic IP using Boto. I found how to assign it to an instance but not the allocation of the IP itself.

Can you show me how to do it?
Thank you

Asked By: user1618465

||

Answers:

In boto you would use:

import boto.ec2
ec2 = boto.ec2.connect_to_region('us-west-2')  # or region of choice
eip = ec2.allocate_address()
print(eip.public_ip)
Answered By: garnaat