Skip to content

Instantly share code, notes, and snippets.

@davidfrey
Created August 4, 2017 18:10
Show Gist options
  • Save davidfrey/6a993c5082bccd6ad35fa93426929785 to your computer and use it in GitHub Desktop.
Save davidfrey/6a993c5082bccd6ad35fa93426929785 to your computer and use it in GitHub Desktop.
AWS Beanstalk SSH Workaround
#!/bin/bash
PROFILE=aws-profile
environment=$1
if [ $# -ne 1 ]; then
echo script needs environment as first arg
echo usage: $0 environment
exit 1
fi
echo using environment $environment
first_instance=$(eb list -v | grep Environments: -A 100|grep -v Environments:|grep $environment|cut -d\' -f2)
echo using first instance $first_instance
publicdnsname=$(aws ec2 describe-instances --instance-ids $first_instance --profile $PROFILE|grep PublicDnsName|cut -d\" -f4|head -n1)
echo using public dns name $publicdnsname
echo trying ssh using bastion
ssh -i ~/.ssh/wst-launch.pem ec2-user@$publicdnsname -o ProxyCommand='ssh -i ~/.ssh/id_rsa -W %h:%p user@host'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment