Welcome back to BackSpace Academy. In our first ec2 lab we launched an ec2 2
Linux instance and we were running a Wordpress application on that and we 3
used a username and password to log in to that instance. Now that's great 4
because as a wordpress administrator we can create blog pages we can change 5
menus we can upload images we can do all that stuff that you would do through the 6
WordPress application but what happens if we want to actually change the 7
WordPress application itself we want to change one of the PHP files, we want to 8
change one of the configuration files? To do that we need to connect into the 9
Linux operating system that is running our WordPress application. So to do that 10
we can connect remotely into our ec2 server using secure shell and that will 11
give us direct access to the Linux operating system. Now this is a hands-on 12
demonstration so I'm going to show you how it's done but I don't expect you to 13
do this yourself it's not a lab and it goes a little bit beyond what you need 14
to know for a cloud practitioner but you still need to know that you do you are 15
able to access Linux servers using secure shell or Windows servers using 16
Remote Desktop Protocol. So what we'll do is we'll launch an ec2 instance and then 17
we'll create a key pair and download that key pair and we're going to use 18
those credentials to access this ec2 linux server okay so starting off in the 19
ec2 management console I'll just very quickly go through what we've already done 20
we launch an instance will select the AWS marketplace as before we'll 21
search for WordPress 22
well select WordPress certified by BitNami, continue, select a t2 micro 23
because it's on the free tier, we'll select next, will auto assign a public IP 24
because we want to access this through a browser, We will click 25
next add storage, next again, we're just going to add a tag just a name for this 26
now name has to be capital N, we'll just call it ssh test and next 27
now the BitNami ami has recommended or has listed some recommended rules for a 28
security group here so we've got here HTTP and HTTPS as you would expect for a 29
wordpress web server but there's also one there for SSH on port 22 so that 30
means that we can access if we if we use a security group we can access from 31
anywhere on port 22 and get direct access to our Linux operating system and 32
we can see here we can access from any IP address but we still need security 33
credentials to do that but is also a good idea and it is certainly 34
recommended if you have a static IP address that you're connecting from to 35
use my IP and that way anyone else from any other IP address cannot access this 36
instance so I'm just going to leave it as it is but in a real situation you'd 37
probably lock that down to your IP address and we'll come up with a warning 38
as well later on so we just click on review and launch and there we go it's 39
telling us set on port 22 and some others we've got open to the direct or 40
open to all IP addresses we know about that it's not a major concern for its 41
we're going to shut this down straight away anyway so we just click on launch 42
now I'm going to create a new key pair and I'm just going to give that key pair 43
a name tests maybe whatever and I'll just 44
download that keep here now. Now this key pair is really important you need to 45
save it somewhere and you generally use the same key pair most of the time for 46
groups of instance that you're launching if you lose this key pair you will never 47
be able to access the ec2 instances that you've created so it's very important 48
you cannot get this again off AWS ,you can only get it now, once you 49
click on launch instances you won't be able to get that back again 50
so I'm just going to click on launch instances okay so after about 10 minutes or so we've 51
got our WordPress application up and running and we've got these status 52
checks all completed and ok so we can now go to that public IP address again 53
and have a look at our WordPress application in our browser and there it 54
is and as before we can log into it if we have our username and password so 55
again as before we're going to go to actions we go to instance settings and 56
get the system log and that will be all of the console output from our Linux 57
operating systems we'll scroll down to the bit to the bottom and we'll get our 58
password there and our application or our username will be user so let's 59
scroll down and we will log in and we'll use user and password and we'll login 60
and that will get us into the administration page or the 61
administration dashboard of our WordPress application so that's great so 62
just close out of that now but what happens if we want to get in and we want 63
to play around with some of these configuration files so what we need to 64
do now is that we need to connect to our Linux operating system so the easiest 65
way to do that if you're running on Windows is to use a bash client that 66
will allow you to run bash or unix bash commands on a Windows operating system 67
if you're using a Unix environment such as Linux 68
or UNIX type environments such as Mac then you'll be able to just use it 69
through your terminal application provided you you navigate to where your 70
key pair is located, so I'm just going to 71
jump into where I've put my key pair and here it is my test at p.m. key pair and 72
I've just downloaded that to my onedrive now if I've got Windows forget installed 73
and you just go to Windows forg GIT org 74
or sorry Git for Windows. So if you go to Git for Windows and you download that 75
and install it what it will have is it will have a git bash here option when 76
you right-click on on your file explorer so they click on that now I'm just going 77
to click on that now and it's going to give me a UNIX type input screen or 78
UNIX type terminal there so what I can do now is I can run UNIX type commands 79
here so I'll just click on connect here and that will give me the SSH command 80
that I need to connect to my Linux operating system so if I put paste that 81
in there now and I click enter and there we go it's connected me into my my 82
operating system now I've connected into this before there will be another part 83
before that will ask you to say yes or no you just type in yes to accept that 84
that keypad all those credentials and that will get you straight into the 85
Linux operating system so from here we can just do a LS command and we can see 86
all of our files and directories that are there now instead of downloading the 87
consort of the Linux console log or system log we could actually log in like 88
this and we can get our credentials for that or for our WordPress application 89
here by just having a look at it so we can just see here 90
VI and bitNami underscore credentials 91
and there we can see we've got our default username and password is user 92
and there is our password. Okay so that brings us to the end of this hands-on 93
demonstration it's not a lab I don't expect you to do this yourself but you 94
do need to remember that you can connect in remotely to ec2 instances if it's a 95
Linux instance you can do that using secure shell on port 22 if it's a 96
Windows Server instance you can do that on port double three eight nine using 97
remote desktop protocol or RDP so what we'll do now is we'll just exit out of 98
this and that will close that connection and of course the next thing we need to 99
do is to terminate our instance so again actions instance state and terminate so 100
that brings us to the end I'll look forward to seeing you in the next 101
lecture