Created
October 23, 2013 20:20
-
-
Save sredhar/7125981 to your computer and use it in GitHub Desktop.
Release unused elastic IPs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto | |
import boto.ec2 | |
conn = boto.connect_ec2() | |
eips = conn.get_all_addresses() | |
for eip in eips: | |
if eip.association_id is None: | |
try: | |
conn.release_address(public_ip=eip.public_ip) | |
except boto.exception.EC2ResponseError: | |
conn.release_address(allocation_id=eip.allocation_id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment