import boto3 ec2 = boto3.client("ec2") res = ec2.describe_instances(InstanceIds=['<instance-id>',]) print(res["Reservations"][0]["Instances"][0]["PublicIpAddress"])