1 00:00:00,640 --> 00:00:03,310 Okay, so let's go into the ECS console, 2 00:00:03,310 --> 00:00:06,810 to start using the Elastic Container Service. 3 00:00:06,810 --> 00:00:09,440 So what I'm going to do is going to get started, 4 00:00:09,440 --> 00:00:12,040 and then we have to create our first cluster. 5 00:00:12,040 --> 00:00:13,560 So let's create a cluster, 6 00:00:13,560 --> 00:00:15,960 and this is a cluster we're going to give so name, 7 00:00:15,960 --> 00:00:16,793 so DemoCluster. 8 00:00:18,140 --> 00:00:19,840 We need to choose a VPC, 9 00:00:19,840 --> 00:00:20,880 which was the default VPC, 10 00:00:20,880 --> 00:00:22,120 as well as subnets, 11 00:00:22,120 --> 00:00:25,230 and this is where our resources are going to be deployed. 12 00:00:25,230 --> 00:00:29,040 Now we have different choices for the infrastructure. 13 00:00:29,040 --> 00:00:30,290 And as you can see, 14 00:00:30,290 --> 00:00:32,439 the number one that is selected by default 15 00:00:32,439 --> 00:00:34,590 is to use AWS Fargate. 16 00:00:34,590 --> 00:00:37,810 And Fargate is a serverless type of infrastructure 17 00:00:37,810 --> 00:00:39,620 in which you pay as you go, 18 00:00:39,620 --> 00:00:42,910 which is very helpful to run just instance, 19 00:00:42,910 --> 00:00:45,360 ECS tasks on the go. 20 00:00:45,360 --> 00:00:49,300 But if you wanted to manually provide Amazon EC2 instances, 21 00:00:49,300 --> 00:00:50,360 you could as well, 22 00:00:50,360 --> 00:00:53,330 and therefore you would need to create a new ASG, 23 00:00:53,330 --> 00:00:55,010 then you would need to choose an operating system, 24 00:00:55,010 --> 00:00:57,210 such as Amazon Linux two, 25 00:00:57,210 --> 00:00:58,980 an instance type, for example, 26 00:00:58,980 --> 00:01:02,290 your t2micro instances, 27 00:01:02,290 --> 00:01:03,930 your desired capacity for your ASG, 28 00:01:03,930 --> 00:01:05,050 so between zero and five, 29 00:01:05,050 --> 00:01:06,150 and zero and one. 30 00:01:06,150 --> 00:01:07,370 And then if you, 31 00:01:07,370 --> 00:01:10,350 if you want a SSH or not into them. 32 00:01:10,350 --> 00:01:13,500 So for the sake of this hands on, 33 00:01:13,500 --> 00:01:16,660 I can create one and show you what it's like. 34 00:01:16,660 --> 00:01:19,440 So I'll just choose zero and maximum five. 35 00:01:19,440 --> 00:01:22,140 And also we could specify external instances 36 00:01:22,140 --> 00:01:23,960 using ECS anywhere. 37 00:01:23,960 --> 00:01:25,560 This requires manual configuration, 38 00:01:25,560 --> 00:01:27,250 and need to register your servers 39 00:01:27,250 --> 00:01:28,850 maybe from on premises, 40 00:01:28,850 --> 00:01:31,680 onto your ECS cluster. 41 00:01:31,680 --> 00:01:33,820 So monitoring is optional, 42 00:01:33,820 --> 00:01:34,830 and tags are optional, 43 00:01:34,830 --> 00:01:36,410 so I'll leave it as is. 44 00:01:36,410 --> 00:01:39,180 So let's create this cluster. 45 00:01:39,180 --> 00:01:40,050 And in this cluster, 46 00:01:40,050 --> 00:01:41,220 as you remember, 47 00:01:41,220 --> 00:01:44,070 I've created both the Fargate launch type, 48 00:01:44,070 --> 00:01:45,820 which was selected by default, 49 00:01:45,820 --> 00:01:48,930 as well as the EC2 launch type. 50 00:01:48,930 --> 00:01:51,850 And to show you how the EC2 launch type works, 51 00:01:51,850 --> 00:01:54,713 if I go into the auto scaling groups, 52 00:01:55,940 --> 00:01:57,400 and then on the left hand side, 53 00:01:57,400 --> 00:01:59,943 I will click on auto scaling groups right here, 54 00:02:00,840 --> 00:02:01,673 and it's showing, 55 00:02:01,673 --> 00:02:02,610 as you can see, 56 00:02:02,610 --> 00:02:04,590 there was an auto scaling group created for me, 57 00:02:04,590 --> 00:02:07,420 called Infra ECS Cluster. 58 00:02:07,420 --> 00:02:09,160 And desired capacity is zero, 59 00:02:09,160 --> 00:02:10,120 main capacity, zero, 60 00:02:10,120 --> 00:02:11,560 maximum capacity, five. 61 00:02:11,560 --> 00:02:15,060 And this was created directly by my ECS cluster, 62 00:02:15,060 --> 00:02:17,110 and the creation is in progress. 63 00:02:17,110 --> 00:02:18,760 And what this cluster has, 64 00:02:18,760 --> 00:02:20,800 will have maybe EC2 instances 65 00:02:20,800 --> 00:02:22,850 for me to launch tasks on. 66 00:02:22,850 --> 00:02:23,683 So as you can see, 67 00:02:23,683 --> 00:02:25,210 it's in three availability zones. 68 00:02:25,210 --> 00:02:26,490 So we know that the ECS tasks 69 00:02:26,490 --> 00:02:29,210 are going to be launched across three AZ. 70 00:02:29,210 --> 00:02:31,120 And what I'm going to do now is just wait 71 00:02:31,120 --> 00:02:32,900 for this cluster to be created, 72 00:02:32,900 --> 00:02:34,510 which is the case now. 73 00:02:34,510 --> 00:02:37,360 So what I can do now is explore this DemoCluster. 74 00:02:37,360 --> 00:02:39,020 So if I click on it, 75 00:02:39,020 --> 00:02:40,700 I'm in the DemoCluster, 76 00:02:40,700 --> 00:02:42,330 and I can go to services, 77 00:02:42,330 --> 00:02:43,163 there are zero tasks, 78 00:02:43,163 --> 00:02:45,630 there are zero because we haven't launched anything yet. 79 00:02:45,630 --> 00:02:48,490 And then we go to the more interesting infrastructure. 80 00:02:48,490 --> 00:02:50,480 So if you go here to the infrastructure, 81 00:02:50,480 --> 00:02:54,400 we have three capacity providers in this ECS cluster. 82 00:02:54,400 --> 00:02:55,380 The first one is Fargate, 83 00:02:55,380 --> 00:02:57,220 that means that we can launch Fargate task 84 00:02:57,220 --> 00:02:59,020 onto our ECS cluster. 85 00:02:59,020 --> 00:03:00,680 The second one is Fargate Spot, 86 00:03:00,680 --> 00:03:03,710 that means that we can launch Fargate task in spot mode, 87 00:03:03,710 --> 00:03:06,160 so like spot instances for EC2. 88 00:03:06,160 --> 00:03:09,980 And the last one is a ASG Provider, 89 00:03:09,980 --> 00:03:12,910 and this one means that we can launch EC2 instances 90 00:03:12,910 --> 00:03:15,740 in this cluster directly through this ASG. 91 00:03:15,740 --> 00:03:18,170 So it's managed scaling right now, 92 00:03:18,170 --> 00:03:20,380 and the current size is zero, 93 00:03:20,380 --> 00:03:22,630 but I can change it if I wanted to. 94 00:03:22,630 --> 00:03:24,060 So let me show you what it would look like. 95 00:03:24,060 --> 00:03:25,130 I go here, 96 00:03:25,130 --> 00:03:26,830 I go to details, 97 00:03:26,830 --> 00:03:29,630 and I would edit the desired capacity to be one, 98 00:03:29,630 --> 00:03:31,370 just to show you what it's like. 99 00:03:31,370 --> 00:03:32,810 So what's going to happen out of this is 100 00:03:32,810 --> 00:03:37,150 that an EC2 instance is going to be created, okay? 101 00:03:37,150 --> 00:03:37,983 And when it's created, 102 00:03:37,983 --> 00:03:41,363 it's going to register itself into the DemoCluster. 103 00:03:42,520 --> 00:03:45,410 And then I will see it under container instances. 104 00:03:45,410 --> 00:03:47,870 That means that when we create an ECS task, 105 00:03:47,870 --> 00:03:50,260 it can either be launched on a Fargate, 106 00:03:50,260 --> 00:03:52,590 or Fargate Spot capacity provider, 107 00:03:52,590 --> 00:03:55,290 or it can be launched on the container instances 108 00:03:55,290 --> 00:03:58,900 that I will have launched as part of this ASG. 109 00:03:58,900 --> 00:03:59,770 So what I'm going to do now 110 00:03:59,770 --> 00:04:01,110 is just wait for this instance 111 00:04:01,110 --> 00:04:02,230 to be in the running state, 112 00:04:02,230 --> 00:04:04,603 and registered into my ECS cluster. 113 00:04:05,620 --> 00:04:07,000 So let me refresh now. 114 00:04:07,000 --> 00:04:09,580 My instance is in service, 115 00:04:09,580 --> 00:04:10,600 and its t2micro, 116 00:04:10,600 --> 00:04:13,430 and if I go back into my Amazon ECS cluster, 117 00:04:13,430 --> 00:04:16,060 it is registered as a Container instance 118 00:04:16,060 --> 00:04:17,019 that is currently of course, 119 00:04:17,019 --> 00:04:18,140 running zero tasks, 120 00:04:18,140 --> 00:04:21,660 and has 1024 CPU available, 121 00:04:21,660 --> 00:04:25,560 and 982 memory available. 122 00:04:25,560 --> 00:04:28,210 So this is giving me the capacity of this instance, 123 00:04:28,210 --> 00:04:29,630 and I can launch use, 124 00:04:29,630 --> 00:04:30,610 as you'll see task on it 125 00:04:30,610 --> 00:04:32,820 until the capacity runs out. 126 00:04:32,820 --> 00:04:34,050 So we're good to go. 127 00:04:34,050 --> 00:04:35,190 So we have an ECS cluster. 128 00:04:35,190 --> 00:04:36,880 We've seen two capacity providers, 129 00:04:36,880 --> 00:04:38,010 I mean three. 130 00:04:38,010 --> 00:04:39,370 We've seen Container instances. 131 00:04:39,370 --> 00:04:42,920 So now let's go ahead and do run our first service, 132 00:04:42,920 --> 00:04:45,573 and I will see you in the next lecture to do that.