Skip to content

Instantly share code, notes, and snippets.

@saurabh-hirani
Created July 9, 2021 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saurabh-hirani/a566d1278bcceab751c7ec19610b5bbb to your computer and use it in GitHub Desktop.
Save saurabh-hirani/a566d1278bcceab751c7ec19610b5bbb to your computer and use it in GitHub Desktop.
test.py
import boto3
ec2 = boto3.resource("ec2")
for instance in ec2.instances.all():
public_ip = instance.public_ip_address
if public_ip:
print(instance.id, public_ip, "public")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment