Setting up EC2 on a SSH client
Steps to take
Important
When setting up the key pair on your local machine, make sure you save it in a safe directory and add the path like so to the SSH
command: e.g. ssh -i /Users/Ethan/Documents/key-pairs/SSH-TEST.pem" ec2-user@ec2-13-48-67-243.eu-north-1.compute.amazonaws.com
- This is an example for a AWS linux based EC2 instance
- Setup a basic EC2 instance with an AWS based OS
- Ensure that the
key-pair
is eligible for SSH based connections by selecting the related option - Then go ahead and start your instance
- After doing so, click on your instance ID and select the connect option
- After doing so go to the SSH client tab and carry out the mentioned functions in the page
- TO RUN THE
CHMOD
FUNCTION SIMPLY DO SO ON GIT BASH IN THE RELATED DIRECTORY - Use proper paths as well
- TO RUN THE
- Utilize VS code for your SSH client and then go ahead and paste in a command like this (the following is mostly applicable to a AWS linux based instance as the default username is
ec2-user
)
ssh -i /{path to key-pair}{key-pair name}.pem" {username}@{Public IPv4 DNS}
To quickly log in existing session, regard the following code:
ssh -i /Users/Ethan/Documents/key-pairs/SSH-TEST.pem ec2-user@ec2-13-60-9-127.eu-north-1.compute.amazonaws.com
Thereafter, to load into the .venv
using AWS linux regard the following command:
source {envrionment_name}/bin/activate
ssh -i /Users/Ethan/Documents/key-pairs/SSH-TEST.pem ec2-user@ec2-13-61-142-229.eu-north-1.compute.amazonaws.com