user1618465
user1618465

Reputation: 1941

Boto allocate elastic IP

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

Upvotes: 1

Views: 642

Answers (1)

garnaat
garnaat

Reputation: 45846

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)

Upvotes: 2

Related Questions