Skip to content

Instantly share code, notes, and snippets.

@aheld
Created February 13, 2018 18:46
Show Gist options
  • Save aheld/13eb3a602d37c8d20fe2a2ce9e39009f to your computer and use it in GitHub Desktop.
Save aheld/13eb3a602d37c8d20fe2a2ce9e39009f to your computer and use it in GitHub Desktop.
#!/bin/bash
REGION="us-east-1"
PROFILE="prod"
get_ecl_ip(){
aws ec2 describe-instances \
--profile $PROFILE \
--filters Name=tag:Name,Values=enrollecl \
--query "Reservations[].Instances[].PrivateIpAddress" \
--output text
}
get_ecl_key(){
aws ec2 describe-instances \
--profile $PROFILE \
--filters Name=tag:Name,Values=enrollecl \
--query "Reservations[].Instances[].KeyName" \
--output text
}
ECL_IP=$(get_ecl_ip)
ECL_KEY=$(get_ecl_key)
ssh -i ~/.ssh/$ECL_KEY.pem ec2-user@$ECL_IP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment