EC2 instance tricks

# Check the AWS Account id
curl \
  http://169.254.169.254/latest/dynamic/instance-identity/document \
  | grep accountId \
  | awk '{print $3}' \
  | sed 's/"//g' \
  | sed 's/,//g'

# check the assigned role
aws sts get-caller-identity