How to SSH/Connect to EC2 Instances in the Private Subnet

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello in this lecture we are going to learn how to connect to an ec2 instance in the private subnet to connect to an ec2 instance in the private subnet the first thing we have to do is download podi so let's open a new tab and type party p-u-t-t-y and you want to select the second one that says green and o-r-g click that then click download it here under the alternative binary the files you want is the poly file the party.exe you also want the page and file the agent.exe and the podigen dot exe and to download these files all you have to do is click on whichever version you want whether you want the 64 or the 32 and if you click on any of this for example let me click that pager and it is going to download it to your computer and you can just click it to run it so i already have these files on my computer you can see them right here i have the bodygen the body and the pager that's the first thing once you have downloaded the poly file we can close this i'm going to close that then the next thing we need to do is go to our ec2 console so under services i'll select ec2 on that compute make sure you have a key pair when i click on keypair i have my ec2 keypair and also on my ec2 dashboard i have two instances for my last lecture that is running in the private subnet to connect to any of this ec2 instance we have to launch one easy to instance in the public subnet then we will ssh into the instance we launched in the public subnet once we are in that instance we can now ssh into the instance in our private subnet and that's what we are about to do to start let's launch our ec2 instance in the public subnet i'll launch an instance i'm going to select the amazon linux ami it's going to be a t2 micro i click next and i'll select my vpc and i'm going to put it in the public subnet 1 uss1a remember the ec2 instance you are trying to use to ssh into the instance in the private subnet has to be in the public subnet so we have our vpc and we have our ic2 in the public subnet one then we'll click next to add storage click next to our tag give it a name i'll call it the bastion because sometimes they call it jump box or bastion host now click next to add security group i'm going to select the existing security group and i'm going to select my ssh security group and look at my ssh security group i have my ssh on port 22 and this is just for practice normally you want to limit the source of your ssh to your ip address i'll click review and launch and launch my instance i'm going to select my key pair acknowledge and launch instance view that instance and i'm going to wait for that instance to launch while i'm waiting for my instance to launch i'm going to open the party keygen which is the one with the key and it is going to open this i'm going to load my key pair into it and it's my ec2 key i'm going to load it into it click open my key is in there then i'm going to put a passphrase on it and this password is just for extra security and once you've put your passphrase and confirm it then click save private key and i can just override my original key or save it on it click save and i'll click yes to overwrite it so anytime i want to use this keypad to ssh into my ec2 instance in the private subnet i have to enter this passphrase so we are done with party keygen close that the next one we are going to open is page ant and it is this one with the cap double click it to open it and when you open it it would act as if nothing happened but look in the lower right hand corner of your computer and you will see it in there i'm using a dual monitor and it is showing up on my other screen that's why you're not seeing it in here but look in the lower right hand corner of your computer and you should see that page and in there so once you see it in that lower right hand corner you can double click it to open it and it is going to open this now we are going to add our key pair into it i'm going to click add key i'll select that my c2 key pair and now it is asking me to put in this passphrase i'm going to enter the password that i created for the keypair and click ok and i've added my key pair to the page and now i can press x to close that let's check whether our yc2 installs is up and running i'll click refresh yes our ic2 instance is up and running next we are going to open podi it is the one with the computer to computer click on it then on that ssh click on the drop down arrow select alt then click on allow agent forwarding we'll check that so once you check that let's scroll up i'm going to increase my font so you can see what's on my screen then on that session what you want to do in this type ec2 iphone user at the public ip address of the ec2 instance we launched in the public subnet so i'll select that ec2 instance and i'm going to copy the public ip address which is right here once i copy it in here i'm going to type ec2 iphone user at that ip address then once you type it click open and click yes so now we have ssh into the instance in the public subnet from that instance we are going to ssh into the instance in the private subnet and to do that all we have to do is let's pick one of this ec2 instance in the private subnet i'll pick the first one both of these ec2 instances are in the private subnet and you can tell because when i click on that instance to see the information i don't have any public ip address but i have a private ip address for server 1b it's also the same thing i have a private ip address i don't have any public ip address meaning that those two instances are in the private subnet let's just pick one of this i'll click this server 1a then i'm going to copy the private ip address once you have copied the private ip address of the instance in the private subnet we'll type ssh space then we'll type ec2 iphone user at then we will paste that private ip address we copy once you press it press enter and it is going to give you this information we are going to type yes and press enter and now we have connected to that ec2 instance in the private subnet and if you look look at the ip address up here ec2 user at ip address and it is the same ip address as our private instance meaning that currently we are connected to the ic2 instance and this is how you connect to an ec2 instance in the private subnet thank you and i'll see you in the next lecture bye
Info
Channel: AOS Notes
Views: 11,384
Rating: 4.9039998 out of 5
Keywords: aws notes, How to Connect to ec2 Instances in the Private Subnet, aws, vpc, private subnet, nat gateway, amazon web services, aws cloud, ec2, cloud, nat, cloud computing, aws knowledge center videos, ssh, aws tutorial, certification, aws vpc, subnet, public subnet, private, security, amazon, aws tutorial for beginners, acl, demo, introduction, solution, contact, training, assistance, vilt, virtual instructor led, internet, subnets, gateway, route table, tutorial, elastic ip, networking, public subnets
Id: yCl8wkdSHA8
Channel Id: undefined
Length: 8min 2sec (482 seconds)
Published: Fri Nov 13 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.