import boto3
ec2 = boto3.resource('ec2')
instances = ec2.create_instances(ImageId='ami-f0091d91', MinCount=1,
    MaxCount=1, InstanceType='t2.micro', KeyName='<KEY-NAME>',
    SecurityGroups=['<GROUP-NAME>'])
instance = instances[0]
instance.wait_until_running()
instance.load()
print(instance.public_dns_name)
Retrieving public dns of EC2 instance with BOTO3