-
-
Save oldpatricka/7373618 to your computer and use it in GitHub Desktop.
Use like: $ EC2_HOST=myiaas.example.com AWS_ACCESS_KEY_ID=somekey AWS_SECRET_ACCESS_KEY=somesecret python list_instances.py
This file contains 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
#!/usr/bin/env python | |
import os | |
from boto.ec2.connection import EC2Connection | |
from boto.regioninfo import RegionInfo | |
host = os.environ["EC2_HOST"] | |
region = RegionInfo(name="Nimbus", endpoint=host) | |
conn = EC2Connection(region=region, port=8444, validate_certs=False) | |
rs = conn.get_all_instances() | |
for r in rs: | |
for instance in r.instances: | |
print instance | |
print instance.instance_type | |
print instance.public_dns_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment