Skip to content

Instantly share code, notes, and snippets.

@li0nel
Last active January 1, 2019 06:00
Show Gist options
  • Save li0nel/b01c21756f4c67bb514d076dd36de49a to your computer and use it in GitHub Desktop.
Save li0nel/b01c21756f4c67bb514d076dd36de49a 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