Skip to content

Instantly share code, notes, and snippets.

@thehelvetian
Forked from li0nel/bastion.sh
Created January 1, 2019 06:00
Show Gist options
  • Select an option

  • Save thehelvetian/382c10c9b666011392108d91d4f6e370 to your computer and use it in GitHub Desktop.

Select an option

Save thehelvetian/382c10c9b666011392108d91d4f6e370 to your computer and use it in GitHub Desktop.
Connect to ECS instances in private subnets through a bastion
# Add your key to your SSH agent
ssh-add -K laravelaws.pem
# Verify that your private key is successfully loaded in your local SSH agent
ssh-add –L
# Use the -A option to enable forwarding of the authentication agent connection
ssh –A ec2-user@<bastion-public-IP-address>
# Once you are connected to the bastion, you can SSH into a private subnet instance
# without copying any SSH key on the bastion
ssh ec2-user@<instance-private-IP-address>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment