Launching Your First AWS Linux EC2 Instance

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome everybody and today I want to show you how to create your first Linux ec2 instance now when you become familiar with creating your ec2 instances it'll take you no time at all to create them but we're gonna look at every single option we have with our ec2 instances today so don't think it's a little bit of time to create our first ec2 instance but once you get the hang of it you'll find that it's pretty simple to get them set up and running you just have to do your planning ahead of time to make sure you know what to choose you're going through it so first and foremost let's make sure we are choosing the region we want this ec2 instance to be setup in so I'm going to go ahead with Canada Central from my drop-down list and then once I've chosen Canada Central I'm gonna go under services and we're going to pick ec2 from our menu and then once we are in our ec2 management console on the left hand side I'm going to click on instances and then we'll pick launch instance so the first item on our list here step number one is to choose your Amazon machine image this is your template and it's going to describe things like the operating system or an operating system with applications or an operating system with applications and different services set up on it so you're choosing here essentially what you want running on that particular server so under a QuickStart we have our Amazon Linux ami so we have our SUSE Linux AMI we have Red Hat we have Windows in many different flavors so depending on what you are trying to build we'll determine which of these am I to choose now if you have a mis that you've already pre-built which we don't at this point in time but if you did you'd find them under my a.m. eyes you can also find a.m. eyes underneath your Amazon Marketplace you'll see here there's options for Barracuda and juniper networks and Trend Micro and then there's also some community a.m. eyes as well and you can see that we go deeper and deeper into the options that we have when it comes to the a.m. eyes that are available to us so today it's just a simple Linux installation we're going to do and I'm gonna pick this top option right here and we'll click select next step 2 is to choose our instance type so instance type is referring to the amount of CPU processing power we need how much memory do we need how much storage space do we need all of that comes into play here under the instance type so you'll see that we have different families of instances we have general-purpose families we have compute optimized we have memory up to my storage optimized so depending on what you are trying to accomplish your overall goal with this particular installation you will choose a respective family for that and then within those families you have Micro you have small you have medium you have large of extra-large and that's really just the categories that AWS is using to describe the number of virtual CPUs the amount of memory the instance storage you're gonna have the type of network performance whether ipv6 is supported or not so we go with a t2 micro you'll see here that we have one virtual CPU one gig of ram but if we go for a t2 large we get two virtual CPUs eight gigs of ram and if we scroll down we'll see some of these options with 96 virtual CPUs and 384 gigs of ram so planning ahead of time strategizing identifying what you need for your installation is gonna be very important because once you get to this page you need to know what your requirements are so in this example here we're just gonna pick the general purpose t2 micro it's good enough for this demonstration next configure instance details however if I am happy with all the defaults that's right if I'm happy with all the defaults we can just click on review and launch I don't have to go through any other steps we can launch a server right from here but I want to go through all the other details with you and we're gonna adjust some of them and modify them to meet our needs so let's go ahead and click on configure instance details and on this page now we configure those instance details so first and foremost it's asking us how many do you want to launch I'm just gonna launch one right now but we could launch two three four five six however many AWS will allow us based on our account limits I'm gonna go with one however if you want to install multiple service at the same time that are going to work together in a group then it's highly advisable to use a auto scaling group instead of this method right here if you want to use spot instances you can pick those here more on spot instances in another video but networking this is where we choose which virtual network we want our server to be placed in right now I don't have any virtual networks that I've created in Canada central so there is a default virtual network that is available called the default VPC so I'm gonna go ahead and place my server in this default VPC however if you have custom virtual networks already created go ahead and choose that one if it's okay to put your server in that custom virtual network if not go ahead and put in this default VPC within a VP see you have subnets and there are two default subnets within our default VPC we have a default subnet in Canada central availability zone 1a and we also have a default subnet in the Canada central one beat availability zone or you can just say no preference and allow Amazon to choose the subnet and the availability zone simply based on however they feel like allotting it to you at this point in time it'll typically based on resource utilization and that particular availability zone so if there's one availability zone being over utilized right now they're gonna go ahead and put you in the other one just to try and balance things out so I'm gonna go ahead and pick one a I'm not gonna let AWS pick for me I'm gonna pick one a availability zone and then assigning the public IP address how do I want it assign do I want to just use the subnet settings and in this case the subnet has been figured because it says enabled here to give out IP addresses so I could just go with that or I can say yes for if I click on enable or we can say disabled which is really meaning no don't give it a public IP address so I'm just gonna go with the subnet setting which is enabled which means give it a public IP address I am roles are utilized to control permissions and privileges between different resources and services and users so for example I can create a role that elevates my privileges so that way there I can perform some sort of action on a service that I would otherwise not have the ability to do so if I want to perform that action I elevate my privileges with that role and I perform that action well we can do the same thing here by default this server is not going to have permissions to let's say interact with an s3 bucket but if I create a role like the one we see here allow s3 to access ec2 buckets which I created in a completely different service called identity and access management well I could create this role and I can now allow this server to access resources that are in an Amazon s3 bucket right now we don't need that because I'm just gonna go ahead and create the server and then log into it and then perform typical Linux commands on the Linux server so I don't need a role right now at any point in time if you needed to add a role for the server you can go ahead and do that shut down behavior this allows you to control what happens when somebody's in the operating system and they issue some sort of shutdown command or they click on an option and then the Windows graphical user interface and they click on shut down and shut down the server well what happens does the server just stop or is a server terminated mean meaning it gets completely deleted out of your AWS account so I'm just gonna go with the default here of stop protect against accidental termination this is an option that allows you to can trol whether somebody's allowed to terminate the server or not so if somebody clicks on the server and the management console and they click on terminate well then the server gets completely removed however if we click on this button they would have to take an additional step they would have to shut off accidental termination protection and then click on terminate so it's just adding one extra step that would be required if you want to terminate the server so this allows you just to protect yourself and your server from accidentally being terminated I'm okay with that being unchecked right now by default you're gonna have basic monitoring with ec2 if you want detailed monitoring and an additional cost you click on this button and you're gonna get more more aggressive statistics in regards to the performance of your server tenancy I'm gonna go with shared here simply meaning that when this server is launched it's going to be on hardware that is being used by other organizations and AWS customers as well or I could choose dedicated and dedicated would mean that that hardware is dedicated for me and me alone so share this fine right now t2 unlimited more on that in another session in this case has no effect on us whatsoever networking interfaces you automatically get one primary network interface for your virtual server if you want to add more network interfaces you can do so by clicking on add device and you'll be able to add more virtual network interface cards to that server advanced details this allows you to input what is known as user data code scripts and the code and scripts are going to be executed once the server is up and running so in this case we're launching a linux server when this Linux server gets launched without any additional user data then the server is just going to be in its default State however if I add user data here once the server is completely launched the code the script that is in here will be executed so for example maybe I to start the HTTP service I can put code in there for that maybe I want the server to reach out to an s3 bucket and download files and place them in a specific folder on the server so that way there those files are available I would put that code in there to accomplish that so if you want your server to be more than just the basic installation you can have code in here scripts that will be executed and then your server will be more readily available to you once it's up and running so you can have it more tuned to your specific needs before you even log in by running your script right here next we click on add storage so I'm gonna click on add storage by default you're gonna get one volume and then in this case it's an e BS volume it is our root volume default size is 8 gigs I can increase that size to whatever I need in this case I can go up to 16 terabytes for an EBS volume when you're using a root volume the best option is the general-purpose SST SSD gp2 but you do have other options provision I ops SSD as well as magnetic but for root volumes it's highly highly recommended you go with the general-purpose SSD we're gonna choose that here delete on termination is set right now which means that when we delete the server the hard drive will be deleted as well all the information pertaining on it if I do not want that hard drive to be deleted when we terminate the server then I simply uncheck that and this hard drive this volume it's called an EBS volume will remain why well the when you're using an EBS volume that is not on the same physical device as the server is so you have your host your server physical server and there are hard drives in that those are called ephemeral drives or instance storage volumes in the world of AWS well these ones here these EPS volumes are more like sand devices storage area network devices so the EBS volume is separated out from the actual host so therefore if there's a failure of the host all your information is still available on the EBS volume so there's route volume is stored elsewhere then on the actual host so that's why we can choose whether we want to delete on termination or whether we want to preserve that volume if the server ever gets terminated and it's not encrypted but we do have the ability to encrypt volumes on certain devices if I add another volume to this server which I can do by clicking on add new volume right here you'll see that I do have the option to encrypt this one if I want to let's click on add tags now tagging is a way for us to provide additional descriptions and information about our server most people skip this because they feel it's a waste of time I highly encourage you to embrace tags tagging is going to be extremely valuable to you long term especially when you have to provide reports on servers and services billing information on servers and services or by Department so take an advantage of tags early on and making sure that it is something that is always done for every single AWS service you introduce is really valuable to you and your organization so I'm just gonna click on add tag and here's a simple example the key I'm gonna call it name and then the value what's the name of this server well we might call it Linux s rv1 as an example so add another tag what department is this for well let's say this particular department is hosting what about another tag what is the the purpose right now of this server the purpose of this server might be for just testing reasons so the more key value pairs the more descriptive you are with these tags and the information the more valuable this information will be for you long term in your organization especially like I said running reports or coming up with billing information very very valuable next let's configure our security group what is a security group a security group is utilized to control the traffic that's flowing in and out of your server you can create these security groups ahead of time or you can create them now when you're launching a service so if we already have one I can click on select an existing security group right now in Canada central I only have the default security group but let's go ahead and create a new security group here on the fly because most of us even though we are building a Linux server for the first time that default security group is still not going to allow us to access the server over the Internet for management purposes so let's create a new security group right now and I'm just gonna call this one Linux demo provide connection to my server we administer our Linux servers using SSH part number 22 and AWS recognizes that so it has already pre-populated this information for me whereas if it was Windows it would populate it with RDP port numbers so right now it's saying that you can administer there are connect to this server using SSH port number 22 from any IP address in the entire world that is not the best option however that's the option I'm gonna go with here so just a little advice here for each and every single one of you out there if this is your if your going to be connecting to this server for administrative purposes to play around with it from your corporate network find out what the public NAT IP addresses are that you get translated to when you go out to the Internet and populate this field with the range of addresses if you're at home right now and you are messing around with AWS put your router's public IP address right here because that is typically what your internal IP address in your home is going to be translated to when you go to the internet so change that to your public IP address of your router so that way there you are protecting yourself from having connections from unwanted users on the Internet whereas right now I'm allowing everybody to connect any even warns me here don't do that but hey that's what I'm gonna do in this case let's click on review and launch now it's a review and launch and then it's just gonna go through everything if I'm happy with it I'm gonna click launch now it asks me for a key pair so if you have no other way to connect to your linux server meaning you don't have any other options in place you haven't used the user data to script the creation of another user and to download a public key of a public/private key pair from a secure repository that you have set up so everything you can log in after the fact you will need to create a key pair so a key pair is a public key and a private key the public key will be on the linux server and the private key will be downloaded to your personal machine you're using to create this key so ever creates this key will get the private key given to them if that was somebody else in your organization you'll have to get the the key from them in order to log into the server because when you log into the Linux server it needs that private key in order to authenticate between the private and public key when you connect as well as a username that we will find out shortly about so I do not have a key pair right now so I'm gonna create a new key pair and we'll call this one a linux demo it's that easy to create it I click on download key pair and it's gonna download the private key to my local machine so I have two other ones here from before but I'm gonna add this Linux demo one click on save and I have it locally now in my folder so now I'm gonna click Launch instance and the instance is being launched so let's go back now and click on View instances and once it's ready meaning when our instance state is running and our checks are two for two then we're gonna be able to log in so while this is going on I need to do something in the background because anybody who is using putty to connect to the Linux servers are gonna need a PPK file well I didn't get a PPK file I'm gonna go right now to my downloads folder and what we're gonna see here is that we have my linux demo PEM file well putty requires a PPK so if your terminal program whatever you're using you is gonna accept PEM files then no problem but if you require a PPK file like in the case of putty you're gonna have to convert this so let me show you how to convert that while we're here when you download and install putty you're also gonna get this program here called putty key generator so open up putty key generator and then click load grab your PEM file so in this case it's Linux demo PEM and click OK and then click Save private key and that's going to create a PPK file for you instead are you sure you want to save this key without a passphrase yes I don't need a passphrase in this case so click yes and then what do I want to call it I'm gonna call it Linux demo and it is a PPK file not a PEM file now so save it as a PPK file and there it is showing up right there now linux demo so that's the one I'm gonna use now that PPK file when I'm using putty but like I said before if your terminal program can use PEM files then you can just use that PEM file right there alright so now it says running still doing its status checks but let's go ahead and try to log in to this particular server now I'm gonna open up putty there it is we need our DNS name so we can either go with this DNS name here or we can go with this public IP address one or the other so I'm gonna grab the DNS name of this server paste it in there port number 22 using SSH and then now under SSH I'm gonna expand that click on off and this is where I put in that private key file so I'm gonna click on browse linux demo cuz that's the one that we told this server it's gonna use cuz the server remember has the public key right now installed on it this is the private key that corresponds with that public key and then I'm just gonna click open now and I'll get this security alert because this is a self-signed key it's not part of the PKI system public key infrastructure I did this all myself it's self signed it's not signed by certificate authority so I'm happy with it yes and now it says what do you want to login as so for everybody out there logging into the first time to a default installation of a Linux AWS ec2 instance its ec2 - user and since I have the right private key and the server has the public key on it I should successfully authenticate so it's as easy as that folks I am now logged in to my ec2 server and when you pre plan and you know exactly what you need to do and you don't have to listen to me go through every single option you could have the server created and you could probably get locked in within a minute and a half from start to finish fantastic so folks enjoy I highly encourage you to get out there now and start creating some Linux ec2 instances so take care folks and we'll see you next time
Info
Channel: StormWind Studios
Views: 72,621
Rating: undefined out of 5
Keywords: AWS, EC2, AMI, Linux, Raymond Lacoste, StormWind, StormWind Studios, SysOps, Amazon Web Services
Id: kjrKDtxAZpE
Channel Id: undefined
Length: 25min 4sec (1504 seconds)
Published: Fri Apr 20 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.