#!/bin/bash

[ -z "$AWS_PROFILE" ] || [ ! -r "$HOME/.aws/credentials" ] && echo "AWS credentials not found"  && exit 1

[ -z "$1" ] && echo "No instance id found" && exit 1  

instace_id=$1

aws ec2 describe-instances --instance-ids $instance_id \
    --query 'Reservations[*].Instances[*].PublicIpAddress' \
    --output text
