From the course: Getting Started with ECS

Create an ECS cluster

- Let's head into the AWS console. But before we go to the ECS service, let's create the SSH key, that we'll later use to SSH into the ECS instance. So to do that, we'll first go to EC2, and then on the left, select this key pairs, and on the top right, create key pair. I'm just going to give my key pair a name of ECS key. And I'm going to select the pem format and create. Now that should download a private key to your computer, and I'll use that later to SSH into my ECS instance. Okay, now we can head into the ECS service. So let's navigate there now. And on the left-hand column, click on clusters. Create cluster. And there are three options you can choose. You can choose the Fargate option, the EC2 Linux Plus Networking, and EC2 Windows Plus Networking. For this course, we'll be using the EC2 Linus Plus Networking. This will create an EC2 instance that will serve as the ECS hosts, where all of our containers will run on. Click next step. And then here, I'm just going to give my cluster a very original name of test cluster one. And on demand instance is fine. If you choose to bid for an instance, you can choose spot, and scroll down and you should be able to see those EC2 instance type, I'm just going to select a T2 micro, number of instances, a step two, two. And as you can see here in the EC2 AMI ID, by default it selects Amazon Linux Two AMI, you can change that to use Amazon Linux One, if you choose. But I'm going to choose the Amazon Linux Two, I'm going to keep the default 30 gigs for the root EBS volume size. And within this key pair drop down, and we're going to select my ECS key. Now this will create a new VPC to deploy the ECS instance. I'm just going to leave all of this default, and for the security group also default, we'll need to edit this later, once it's created, so that we can allow SSH to the EC2 instances. All right, and everything else, container instance IAM role, that can also be kept default. All right. Let's click on this create button on the bottom. And the give ECS a few moments to provision our resources. And with some editing magic I was able to fast forward, so you don't have to wait and watch my screen while ECS provisions my instances. Okay, now let's head back into EC2 console, and let's take a look at those two new ECS instances. Great, so you can see they're marked ECS instance, EC2 container service test cluster one. All right. Now, remember when I said about editing the security group to allow SSH? Let's do that now. So first need to go into the security group, edit the inbound rules, and add a rule and we're going to do SSH, and I'm just going to allow it anywhere. And then save the rule. Perfect now we should be able to SSH to these ECS instances. Now that you have allowed port 22 through the security group, let's try SSH into one of the ECS instances. So first thing I'll do is C-H mod my key, a hundred, ECS key. All right. Let me just grab one of the public DNS for my ECS instance, and let's do SSH-I ecs key ec2 user at and paste. Right, looks good. Fingerprint check. Perfect, I'm in. Now ECS uses docker assets container run time, so we can check what, which containers are running on this instance right now. So to do that, we'll just do docker PS-A. All right. So we have this Amazon ECS agent latest, this is the ECS agent that will launch containers on our behalf on this instance, great. So everything's working fine with this cluster. We can head back into the AWS console.

Contents