How to connect EC2 instance over SSH using Windows and Mac? | Visual Explanations
Summary
TLDRIn this informative tutorial, the host guides viewers through the process of connecting to an Amazon Web Services (AWS) EC2 instance using various tools and methods. Starting with the creation of an EC2 instance on AWS, the host then demonstrates how to connect to it via SSH with both Windows and Mac/Linux systems. For Windows 10, PowerShell and Command Prompt are used, while PuTTY and MobaXterm are recommended for older Windows versions. On Mac, the default terminal is utilized, and tools like Terminus are highlighted for a more user-friendly interface. The video also covers key management and permission settings to ensure secure connections. This comprehensive guide is designed to help users effectively manage and connect to their AWS instances.
Takeaways
- 🚀 The video continues a tutorial series on connecting to AWS EC2 instances using SSH.
- 💻 The presenter demonstrates how to create a new EC2 instance using Amazon Linux 2 AMI and a T2 micro instance, which is free tier eligible.
- 🔑 A new key pair is created and downloaded for secure SSH access to the instance.
- 🖥️ The video covers different methods to connect to the EC2 instance from both Windows and Mac/Linux systems.
- 🛠️ For Windows 10 users, the presenter shows how to use PowerShell and Command Prompt to SSH into the instance after enabling SSH and setting the correct permissions on the key file.
- 🔒 The importance of protecting the SSH key file with proper permissions is emphasized to ensure secure access.
- 🔄 For older Windows versions, the use of PuTTY as an alternative to connect to the EC2 instance is suggested.
- 🔗 The process of converting a PEM file to PuTTY's PPK format using PuTTYgen is explained.
- 🌐 The video introduces MobaXterm as a tool for Windows users to connect to EC2 instances with a graphical interface.
- 🍎 On Mac, the presenter uses the Terminal application to demonstrate the SSH connection process, including setting key permissions.
- 🎨 Terminus is highlighted as a favorite tool for Mac users, offering a visually appealing UI for managing and connecting to SSH hosts.
Q & A
What is the main topic of the video?
-The main topic of the video is about connecting to an AWS EC2 instance using different methods and tools on Windows, Linux, and Mac.
What are the steps to create a new EC2 instance in AWS as described in the video?
-The steps include selecting the Amazon Linux 2 AMI, choosing the T2 micro instance which is free tier eligible, configuring the instance details without changes, adding a name tag, setting up a security group, and launching the instance with a new key pair.
What is the default username for connecting to an Amazon Linux AMI instance?
-The default username for connecting to an Amazon Linux AMI instance is 'ec2-user'.
How can one check if SSH is enabled on Windows 10?
-One can check if SSH is enabled on Windows 10 by opening PowerShell or Command Prompt and typing 'ssh' to see if there are options displayed or if there's an error like 'switch command not found'.
What is the process to connect to an EC2 instance using SSH on Windows 10?
-The process involves opening PowerShell or Command Prompt, typing 'ssh' followed by the username 'ec2-user' and the instance's IP address, trusting the machine if prompted, and associating the previously downloaded SSH key to the command using the '-i' flag followed by the key file path.
Why is it important to protect the SSH key file when connecting to an EC2 instance?
-It is important to protect the SSH key file because the key is used to authenticate your connection to the EC2 instance securely, and an unprotected key can pose a security risk.
What is the recommended permission setting for the SSH key file on Windows?
-The recommended permission setting for the SSH key file on Windows is to allow modifying the file only by the user who owns it, by removing permissions for all other users and setting full control for the owner.
How can one connect to an EC2 instance using PuTTY on an older version of Windows?
-One can connect to an EC2 instance using PuTTY by installing PuTTY, entering the hostname or IP address, specifying the username 'ec2-user', and using a PuTTY-compatible SSH key file (.PPK) which is created by importing the original .pem file using PuTTYgen.
What is MOBA Xterm and how is it used to connect to an EC2 instance?
-MOBA Xterm is a terminal emulator for Windows that provides a graphical interface for SSH connections. It is used to connect to an EC2 instance by creating a new SSH session, entering the username and IP address, specifying the private key file, and establishing the connection.
What is the recommended permission setting for the SSH key file on Mac?
-The recommended permission setting for the SSH key file on Mac is to change the permissions using 'chmod 400' command, allowing read access only to the owner of the file.
What is Terminus and how does it facilitate connecting to an EC2 instance?
-Terminus is a terminal management tool with a graphical user interface. It facilitates connecting to an EC2 instance by allowing users to add a new host with a label and IP address, specify the username and SSH key, and connect with a single click.
Outlines
🖥️ AWS EC2 Instance Creation and SSH Connection Basics
The script begins with a greeting and an introduction to the tutorial series on AWS. The focus is on creating EC2 instances and connecting to them using SSH. The presenter demonstrates the process of launching a new Amazon Linux 2 instance with a T2.micro configuration, which is free tier eligible. They guide the audience through the steps of configuring the security group and creating a new key pair for SSH access. The presenter also explains how to check if SSH is enabled on Windows 10 and how to connect to the EC2 instance using the command prompt with the appropriate SSH command syntax. The importance of having the correct permissions set for the downloaded SSH key file is highlighted, and the presenter shows how to resolve permission issues to successfully establish an SSH connection.
🔐 Enhancing SSH Security and Connectivity with Tools
This paragraph delves into the details of securing the SSH key file and the process of connecting to an EC2 instance using different tools. The presenter explains how to change file permissions to ensure that only the owner can modify the SSH key file, which is crucial for security. They demonstrate how to use command prompt and PowerShell on Windows 10 for SSH connections. For users with older versions of Windows, the presenter suggests using PuTTY as an alternative. The process of converting an EC2 key from PEM format to PuTTY's PPK format is outlined, along with setting up a PuTTY session. Additionally, the presenter introduces MobaXterm, a tool that provides a graphical interface for SSH connections and includes features like file transfer and a local virtualized Linux machine environment.
🌐 Cross-Platform SSH Tools and Connection Techniques
The final paragraph covers SSH connection methods for different operating systems, focusing on Mac OS. The presenter uses the default terminal on Mac to demonstrate how to connect to an EC2 instance using SSH, emphasizing the need for proper permissions on the private key file. They also introduce Terminus, a popular SSH client with a user-friendly interface, and guide the audience through setting up a new host connection in Terminus. The presenter concludes by encouraging viewers to like and subscribe to the channel for more informative content, highlighting the educational value of the video.
Mindmap
Keywords
💡EC2 Instances
💡SSH Protocol
💡Windows 10
💡Amazon Linux 2 AMI
💡T2 Micro
💡Security Group
💡Key Pair
💡PuTTY
💡MOBAXterm
💡Terminus
💡Permission
Highlights
Introduction to continuing the tutorial on connecting to EC2 instances using different operating systems and tools.
Creation of an 8 abreast EC2 instance and demonstration of connecting to it using SSH.
Explanation of launching a new EC2 instance with Amazon Linux 2 AMI and T2 micro for free tier eligibility.
Tagging the EC2 instance for identification and using a default security group.
Instructions on creating and downloading a new key pair for SSH access.
Visibility of instance launch progress and public IP address display.
Checking SSH availability on Windows 10 via PowerShell and Command Prompt.
Demonstration of connecting to an EC2 instance from Windows 10 using SSH.
Addressing permission denied errors and associating the correct SSH key.
Changing file permissions to protect the SSH key for secure connections.
Successfully logging into the EC2 instance using Command Prompt.
Using PuTTY as an alternative for older Windows versions to connect to Linux machines.
Conversion of the EC2 key from PEM to PPK format for PuTTY compatibility.
Introduction of MobaXterm as a tool for Windows users to connect to EC2 instances.
Demonstration of connecting to an EC2 instance using MobaXterm with SSH.
Switching to Mac OS and using the default Terminal to connect to an EC2 instance.
Using Terminus, a favorite tool for Mac users, to connect to EC2 instances with a beautiful UI.
Final thoughts and call to action for viewers to like, subscribe, and support the channel.
Transcripts
hello everyone and welcome back to the
channel once again and today on arrow to
AWS we will continue from where we left
yesterday we have created our 8 abreast
ec2 instances and in today's episode we
will see much more fun ways to connect
to as such using Windows and using Linux
or Mac and we look at some of the
favorite tools that I have that I wanted
to share with you so without wasting any
more time let's get started
[Music]
[Applause]
[Music]
so the last thing what we had done is we
had created our own a SS ec2 instance so
it's quite fun isn't it
so I would like to create once again one
more new instance for you guys so that
we can continue the flow and I will tell
you the ways we can connect to this
instance using the SSH protocol with the
ways that we have for Windows and Mac so
the first thing that we'll do is we'll
create our instance or we launch an
instance now so what we are going to do
is we are going to follow the steps that
we had followed last time as well so I
will go ahead and select the Amazon
Linux 2 AMI and I will select the T 2
micro that's the free tier eligible and
I will see the configuration instance
everything is same I am NOT going to
change anything so the tag that I'll add
is first is name and this is the one
that we will be using it so next we need
to configure the security group I'll use
a by default security group that is
already available ok so let's search to
my machine I will add the name as a
description here so we can identify this
easily so yeah just I'll click on launch
I will create a new key pair
so the key pair name is this and I will
just download it and just you can just
launch the instance right now so once
you have done all these things you will
be able to see the screen your instances
are now launching so in a few minutes
you'll be able to use these instances as
well so this is the instance list that
we have and I have created the new
instance now so you can see the public
IP that we have here is obviously
displayed 13.1 86 2142 2 2 1 1 9 and the
security group its launch wizard 1 that
we had specified the key pair name as
well and we will not name basically the
pythonic mean that I had for the owner
so it's obviously here so if you're
currently using Windows 10 like cool
then you can go to the powershell and
you can just check whether you have SH
enabled or not so if you get this as
such and you get a lot of options like
this then you have such and you can go
to the command prompt as well and check
the same so if you get the same and both
of them then your SH is enabled and if
you get something like a switch command
not found or something then probably you
don't have a switch and even
your machine maybe you are using an
older version of Windows but now what we
are going to do is we are going to
connect to this machine so on Windows 10
what we are going to do is we're going
to just type SSH
then the username and the IP address so
username for the Amazon Linux AMI -
basically it will always be like ec2 -
user so you just need to type hey c2 -
user and at the rate the IP address so
I'll just copy the IP address and I'll
paste it it is asking for us to
basically trust this machine so what I'm
going to do is I will just trust it okay
so it's permission denied because I
haven't added the key that I had
provided previously or I had downloaded
that so now what I'm going to do is I'm
going to associate that key and attached
to this particular execution command
mean it will give the option of - I
after - line you need to just mention
the path of that particular file name so
I have the file with me here and what
I'm going to do is I'm going to just
copy the file path and I'm going to
specify it here so I'm going to specify
that command - I the path of the file of
that particular SSH key and then they
username at the rate the IP address okay
so no such first nan so what I'm going
to do I'm just going to I iterate to the
particular folder path that I have okay
so I'll just execute the command once
again so what it is selling is
unprotected private key file so what you
need to understand is whenever you are
trying to access a particular SH
instance using a such protocol the key
that you are using for connecting it to
the machine using SSH should be
protected properly so what do you what
are you going to do is you want to
protect it so we'll see what are the
permissions available for that file that
we have so this is the properties of
that particular file so you're going to
click on security so you can see here
that these are the few users that are
already there they are able to actually
manipulate the file so what I'm going to
do is I'm going to allow the permission
for modifying this file only to myself
and for my user itself so what I'm going
to do is I'm going to go to advanced and
I'm going to remove all the permission
from other people that are currently
using it so I'll just remove this
remove this so what it is telling is you
cannot remove system because this object
is inherited permissions from its parent
so we'll remove the inheritance first so
you click on this one click on this
remove all in this I'm going to add
myself so now once I have this I can
just add myself I will give myself the
full control and click on this so now
only I have the access ok so what I did
is I removed the inheritance from all of
them and just I added myself so once you
have done this you can click on apply
click on ok and that's it that's what we
need to make it protected and we are
going to run the same command once again
and it will work yes see we have
successfully logged into the machine and
if you do the same thing using command
prompt also it will work so I will open
the command prompt and if I type here so
now I'll execute the same command again
and you will be able to access the
instance yes it's quite fun isn't it see
I'm able to access it so these are the
two ways that I actually told you right
now and this pretty important when you
using Windows 10 or Windows basically to
change the permission this is really
important most of the times we actually
don't know how to do this but now with
this tutorial maybe it will help you it
has helped me as well so if you really
liked it then hit the like button right
now but moving forward but if you are
using any older version of Windows then
you can probably use putty to connect to
your Linux machine so this also helps
you connect to the last mission using s
switch so what are you going to do is
once you have installed putty you see
your hostname or IP address here is
where we will be entering the hostname
ec2 user at the rate the IP address that
we have so I will go back here and I
will copy the IP address I've copied it
and what I'm going to do is I'll just go
ahead and paste it so once I've done
this I'll just give it a name ec2
instance okay and I'm going to save it
so if you see the key that we can
download it before it is a PM file but
we need to have a secure shell key that
beastly is compatible with putty
so we'll create a putty compatible file
so for that I need to open the putty
kitchen so you can go ahead and check
for party kitchen so once you get the
kitchen what do you need to do is you
need to just reload the private key that
you have go to the desired folder that
you had already placed your file click
on all types ok select the drop down and
click all files and you can just select
the ec2 key dot VM file successfully
imported foreign key ok to use this you
need to just save it and say a private
key command and use it and put his own
format ok once you just click this then
you can just save the private key so are
you sure you want to save this key
without a passphrase to protect it yes I
would definitely want to save it without
a passphrase but if you want additional
security basically you can add a
passphrase to that but I am NOT going to
do it so I'll just click on yes and I'll
save it as ec2 - key dot VPK auto putty
private key so once I've saved it what
I'm going to do is I have selected this
so you see the categories your right go
to the connections part you see a switch
click on this and expand it and you see
author here what you're going to do is
you're going to browse for that file
that we had just created click on that
and select open once you have done that
don't select or don't click on open
right now go to sessions click on ec2
and save it now double click on this see
it's as easy as and it's as simple as
possible so once you have done the part
where you have converted that p.m. file
to PPK file that's when you can use
buttons because if you just import it
and you try to run it it will not work
the next tool that I wanted to share for
Windows is MOBA X term that's also
pretty neat tool I have been using it
since a long time when I was working
with Windows but when I jumped into Mac
I started using dominus so here it is
also very simple and pretty clean setup
that you have so once you have installed
MOBA X term I'll give you the link in
the description below you can just
download it as well so you get to have a
very good interface here the graphical
interface so what you want to do is if
you want to create a session or SS
session or a remote session you can just
click on this click on SSH ok then enter
the same way that you had entered in
party you see - - user at the rate the
IP address and just copy it once again
so to stop and what happens here is you
can either give it here or you can just
specify the username by default that it
will be logged into so specify user name
and you can just type it here and you
can assign the port as well and you need
to mention the private key here so you
need to go to advanced SSH and then you
CA use private key option click on this
checkbox to activate it and browse for
the file so go to desktop means I have
my file on the desktop so and just use
the private key ok so once these
settings have been entered then you are
good to go you can just click OK and yes
we have connected to the ec2 instance
using mobile X term so this is pretty
neat actually you will have a session
here and you can as well drop files and
download files as well using the option
there is pretty cool to have something
like this
and the best part about Globex term is
that you get a local instance where you
wait to play with a local instance of
virtualized Linux machine so if I type
here
unless it'll work so this is pretty neat
so welcome to Mack everyone so Mac I'm
using the by default terminal like Mac
provides me and I'm just going to
execute the same command that I had
executed but I'll use the SSH command
here which I executed on Windows 10 on
the partial so let's go ahead and I'll
provide the destination for that and
I'll add the private key just I'm going
to allow it and the username easy to
have an user and copy the IP address and
I will paste it okay
yes I'm going to allow this oh okay
we face the same problem here protected
unprotected private key file so what we
are going to go is we are going to
change the permission for the private
key that we had and we are going to
allow it for access only to myself so
nitrate to the file and I'll check the
permissions LS - alt R and yes it has
write access for others in groups as
well so I will go to change it I will
see smooth 0 4 0 0 and allow it to just
myself the read permission only for
myself so once you have set the
permissions and this is pretty good to
go then you can just execute the same
again and well I think we should be able
to connect yes we are and let's move on
to the next one so the next important
tool and my one of my favorite tools
that I wanted for you guys to also use
was terminus I have been using it since
long time once since the time that I
have been using Mac so you can just type
in terminus and you can download it I
will provide you the landing link in the
description below you can download it
and what you get with terminus is a
beautiful UI so first of all you need to
continue without a count so not a
problem you don't need to login into
this so once you enter the console what
you want to see is a beautiful UI and
the way we need to add is click on new
host and add the label for the instance
that you want it's like giving the name
for that particular instance and just
add the IP address now you don't have to
worry about groups leave that come down
and you have mentioned as such that's
cool poor tornado is by default you just
need to give the username ec2 - user and
you need to pass the key the H key that
we had click on plus keys and then give
it a label like ec2 - key or something
no passphrase just browse the file once
you have done that just you need to
click on save so that's it and thomas
provides you a beautiful theme as well
like i will be going with the basic
theme and that's it nothing more to do
just click on save so once you have this
just click on connect with a switch
accept it that's it that's it you are
good to go you are able to connect to
the line of so am I so I hope this video
was as informative and as enjoyable as
it gets so if you did enjoy please hit
the like button and if you haven't
subscribed already where you doing man
please subscribe to the channel and uh
then sign off
[Music]
[Applause]
[Music]
Ver Más Videos Relacionados
HOW TO CONNECT TO EC2 INSTANCE FROM WINDOWS LAPTOP | MOBAXTERM | #aws #devops #abhishekveeramalla
AWS Cloud Quest - Computing Solutions - basketball court is the reward!
Access Linux Server Remotely Using SSH - Putty | Windows CMD | GitBash | MobaXterm
AWS Cloud9 | Cloud IDE | Concept | Environment Setup | @Cloud4DevOps
AWS: How To Setup A Site-to-Site VPN (Start to Finish) 2024
How To: EC2 Email Alarm Using CloudWatch (3 Min) | AWS EC2 CloudWatch Threshold Alert SNS Alarm
5.0 / 5 (0 votes)