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