Skip to content

Instantly share code, notes, and snippets.

View rotated8's full-sized avatar

Collin Brittle rotated8

  • Emory University
  • Atlanta, GA
View GitHub Profile
@rotated8
rotated8 / ssh-to-ec2-by-tag-name
Created July 24, 2019 15:38 — forked from SolomonHD/ssh-to-ec2-by-tag-name
Bash function for SSH into EC2 by Name Tag
<< ////
This function will ssh into a EC2 based on Name tags. You can ssh in via public or private IP This function requires awscli to work
There are several optional environment variables:
AWS_PROFILE = Control which profile is active with this variable, if this is unset the function will use AWS_DEFAULT_PROFILE instead
SSH_EC2_KEY_FILE = path to the key file for the user
SSH_EC2_USER = name of the user that logs in, if this variable is unset the value is ec2-user
To use this function do the following commands
(from command line)