From the course: AWS Certified Solutions Architect - Associate (SAA-C03) Cert Prep: 4 Compute Services
Launching an EC2 Linux instance lab - Amazon Web Services (AWS) Tutorial
From the course: AWS Certified Solutions Architect - Associate (SAA-C03) Cert Prep: 4 Compute Services
Launching an EC2 Linux instance lab
- In this chapter, we're going to be going through the various things you can do to get instances up and running within AWS. Now, in my experience, one of the best ways for someone to learn how to work with something is to work with it. So we're actually going to start right off by seeing how we launch a Linux instance here in this episode. And when we do that, we'll see the different properties and configuration parameters that are available, and then we'll also look at how we configure the instance after we've launched it. So we're going to see that in this episode. And then as we continue throughout this chapter, we're going to be learning the details of all the different components that we get to experience in this very first demonstration. So let's take a look at how we launch a Linux instance. So here I am in the AWS management console looking at my services, and I'm going to go under compute right into EC2. Before I do though, just note, you can use Elastic Beanstalk to launch instances, and what it'll do is not only launch the instance, but any other thing you might need to make an entire solution work. We'll talk more about that later. Right now I'm going to go into EC2, and you can see when we come into my EC2 dashboard that I currently have no running instances. In fact, I have nothing of anything except I do have three security groups. There's always a default security group, and there's a couple more in there that I've created before. But other than that, there's nothing here yet. So to create an instance so that I have a running instance, I come down to launch instance. Now, the first thing you have to do is choose the AMI that you want to use to launch your instance. I'm not going to get heavy into the AMIs at this point. These are the Amazon Machine Images, and the reason I'm not is we are going to talk about them in detail later on in this chapter, but for now, just know that it's a snapshot of a virtual machine that you can start your instance from. So you don't have to start with just an empty virtual machine and load your operating system and all of that. You get to start with an operating system that's already installed and partially configured so that you can begin from that point. So we just need to select a Linux AMI. Now, we have several different AMIs that are available for Linux. You can choose the free tier only, and what that's going to do is make absolutely certain that what you select is one that works in the free tier, which is great for when you're doing either analysis of AWS or you're just learning how it works and so forth. So keep in mind the option to simply tick free tier only, so that you're limiting yourself to those free AMIs. So we're going to go ahead and select the Amazon Linux 2 AMI. It gives me a little information about it, telling me it comes with five years of support. It provides the Linux Kernel 4.14. It's optimized for performance on EC2, so that's good. It has some of the development and compiler utilities and libraries that we might need and other software packages as well. So good enough, that's what I want. I'm going to go ahead and choose Select for that particular AMI. And now I need to choose my instance type. If you watched the previous chapter, you know that we went through the various instance types, and the instance types allow you to select the compute capability, the memory capability, the storage capability, and so forth of the instance that you're actually launching. So you want to make sure that you pick the right one. Now, you will notice that it defaults to the one that is free-tier eligible each time you come in here. But if you are moving beyond the free tier, you're actually doing production servers, you may want to choose one of the others. So we have the general purpose family, and as you scroll down, you see that we get into compute optimized, GPU graphics, memory optimized, and storage optimized. So you select the one that you need and choose that particular type of an instance. We're just going to go ahead and stay with the free tier, so we'll leave that selected and click on Next. Now, the next thing is to choose the number of instances. This is actually a very interesting capability of the EC2 instance launch wizard. You can launch more than one instance at the same time. So if I already know I need four different instances using this Linux AMI, I can go ahead and launch all four instances right now. And not only that, but notice the link right beside the dialogue. Right here, it says, launch into auto scaling group. Now, we'll talk more about auto scaling later on and see what it might give us as a benefit, but the point is I can not only create multiple instances, but have them be part of an auto scaling group automatically. I can also indicate that I want this to be a spot instance. So remember we learned that a spot instance means you're using unused compute time. So I can choose that. I need to choose the network. That's the virtual private cloud that I'm a part of. We see the marketing and sales VPCs that I've created in other points in this course. We're just going to go ahead and leave it in the default, in this case. We can also choose the subnet. And the big thing about the subnet is notice the availability zone that it's in. US East 1F, US East 1E, US East 1A, and so forth. So you might want to choose an availability zone if it's important to you specifically where it's located in relation to those availability zones. In this case, it's not as important to me, so I'll leave it as default subnet in any availability zone. You can also auto-assign a public IP. You can either use the subnet setting or you can enable that. If you do, it means it's going to get a public IP address that is available to connect to that device. You'll notice now, we also have the option to use a placement group, which we'll be covering later in this course. But basically a placement group is going to let you implement redundancy, high networking throughput, things like that based on priorities for the group. We can also do capacity reservation. So we're saying ahead of time that we want certain levels of capacity. We could launch an instance and have it associated with an IAM role. And what that does is allow that role to get into that instance, work with it, and so forth. We can choose the shutdown behavior. What do you do if someone shuts it down? Do you want to just stop it or terminate the instance? If you hover over the i, you can see that you're specifying the behavior when an OS-level shutdown is performed. They can either be terminated or stopped. Terminated basically means that it's not planned to come back up again, whereas stopped means it's still in a state where it can quickly come back online. We can also enable termination protection. If we do that, it's going to make it so that a person has to have the right permissions to terminate the instance. They basically have to go in and stop termination protection, and then they can terminate it. That keeps someone from just accidentally terminating an instance. You can enable detailed monitoring. You're going to get basic monitoring at no extra charge. If you want all the detailed monitoring that CloudWatch can provide, you have to check this box, and it's going to cost you more, even though this is free-tier eligible. So that's important to keep in mind. And then finally, you have your tenancy, which can be shared, dedicated, or dedicated host. We'll talk about these in greater detail later on in the course, but for now, we're just going to leave it at shared and discuss what that parameter might do for us later on. Finally, we can do T2/T3 unlimited. And what this is all about is bursting. So if you want to enable bursting for this particular instance, you need to check Enable, and remember, it might cost you a little more to do that. The final element we have here is advanced details. What this is is a place for you to plug in some scripts that you might want to launch when the instance comes online. They could be scripts that update the Linux Kernel or the Linux apps that are installed, and so forth. But you can have scripts here, you can think of it kind of like a startup script that runs every time the instance loads. So that's all we have to configure here. We click on Next, and now we need to add our storage. Now, it's defaulting to using general purpose SSD, and it's eight gibibytes of memory. And so this is giving us something that's very similar to what we used to call eight gigabytes of RAM, but more technically now, the standard is to call it eight gibibytes of RAM. And so that's the amount of memory that we have, which is all I need for my server. So I'm not going to worry about changing that. And in my case, to keep this completely free tier, I'm going to go to magnetic because I really don't need the optimized SSD performance for this. An important thing to consider out here. Notice it says delete on termination. If this is checked, and it is by default, then it means if the instance is terminated, it will be deleted. Now, this goes back to that previous setting difference, stop or terminate. So if you have it so when it shuts down, it's terminated and delete on termination is selected, then it means literally when the OS shuts down, the instance is gone. And that's why that decision becomes so very important to you. Notice encrypted says not encrypted, and it does not give me the option to encrypt it. Well, when you're launching from an AMI, in order to be able to encrypt the root volume, and we'll talk more about root volume types as we go along, but in order to be able to encrypt that root volume, we have to have a custom AMI image where we've already configured it to be encrypted. Because this is launched from an AMI where there is no encryption, I don't have the option to enable that, but if I add a new volume, notice, I could encrypt that new volume, no problem. So I have the option to encrypt it if I'm adding in extra volume but not the root volume from this AMI. We'll just delete that 'cause we don't need the extra volume. And we'll go ahead and click on Next. Now we can add various tags. So for example, I might want to say something like department and say that this belongs to the executive department. And I might want another tag that indicates something about costing for what I'm paying for this. So we'll say cost and free. And so we could add various tags, and this is really just for tracking purposes so that when we're monitoring the different instances, we can filter, say, show me what all of the instances I have that have the value of moderate for cost are actually costing me, or what they're using in CPU utilization, or what they're using in RAM, so I can filter down for reporting purposes. Then we click Next, and now we can configure our security groups. Now, we have a whole section on security groups that we'll be looking at configuring these, so we're not going to configure it now, but you do see the default here is to allow SSH in. Since it's Linux, so I can get in and do command line administration. We'll accept that default for now. Review and launch. And it says, all right, general purpose SSD volumes provide the ability to burst. Do you want to make general purpose SSD the default boot volume for all instances from console going forward? Nah, I could or I could say, no, continue with magnetic. I'm just going to continue with magnetic for this boot volume so it's just giving me a warning that it's not going to perform as well. I'll click on Next. And finally, we click on Launch. The last thing I need here is a key pair. The key pair allows me to SSH into this particular installation, whether I'm using something like PuTTY on Windows or just SSH at the command line on Linux, that's what this allows me to do. Since I don't have any key pairs, it tells me no key pairs found. I need to create a new key pair. I'll give it a name and I'll call it EC2-KeyPair. This is for public-private key encryption so that my communications are encrypted when I access this instance from remote. I'll click on Download Key Pair, and we'll simply save it to the desktop of our machine. That way it'll be there when we need it later on. And now we click on Launch Instances. And that's going to launch the instance. Now, it can take a little while to bring this instance up and begin the actual operations of this instance. Once it's done, you can look at the configuration of the instance. As you can see, launching an instance is really a pretty straightforward process. At this point in time, we've got a Linux instance up and running. The next step would be to make sure it's working. Now, I wonder how we would do that. Well, we'll find out in the next episode when we look at how we connect to the instance in order to be able to configure it internally since we've already got it configured externally as we need. (upbeat music)