1 00:00:00,320 --> 00:00:01,153 ‫So let's have a look 2 00:00:01,153 --> 00:00:03,410 ‫at these options in the Task definition menu. 3 00:00:03,410 --> 00:00:06,160 ‫So let's create a new task definition, 4 00:00:06,160 --> 00:00:07,950 ‫and also demo-taskdef. 5 00:00:08,970 --> 00:00:12,690 ‫Okay, so as we can see we can have a Container-1 6 00:00:12,690 --> 00:00:14,230 ‫it's called in Essential container, 7 00:00:14,230 --> 00:00:16,080 ‫and if it stops the whole task stops. 8 00:00:16,080 --> 00:00:19,300 ‫But you can define multiple containers in here. 9 00:00:19,300 --> 00:00:22,200 ‫Container-2 as well as Container-3. 10 00:00:22,200 --> 00:00:25,640 ‫And each of these containers are defined the exact same way. 11 00:00:25,640 --> 00:00:28,360 ‫And you can say whether or not each of these containers 12 00:00:28,360 --> 00:00:30,230 ‫is an essential container or not. 13 00:00:30,230 --> 00:00:32,130 ‫Essential means that if it stops then 14 00:00:32,130 --> 00:00:34,550 ‫the whole ECS task is going to stop. 15 00:00:34,550 --> 00:00:37,260 ‫Else if it crushes then it's not needed. 16 00:00:37,260 --> 00:00:38,660 ‫So you can define multiple containers 17 00:00:38,660 --> 00:00:40,730 ‫and the pattern for this could be 18 00:00:40,730 --> 00:00:41,990 ‫to have a sidecar container, 19 00:00:41,990 --> 00:00:45,290 ‫for example, to gathering logs and metrics. 20 00:00:45,290 --> 00:00:48,140 ‫So let's assume we only have one container. 21 00:00:48,140 --> 00:00:51,240 ‫Then you need to enter a name for your image. 22 00:00:51,240 --> 00:00:54,890 ‫So wordpress, and then image URI wordpress. 23 00:00:54,890 --> 00:00:56,320 ‫Then you define the port mapping 24 00:00:56,320 --> 00:00:58,840 ‫and you specify on this container, 25 00:00:58,840 --> 00:01:00,130 ‫which ports are exposed. 26 00:01:00,130 --> 00:01:02,930 ‫For example, wordpress, if it exposes the port 80, 27 00:01:02,930 --> 00:01:04,630 ‫then I would set up 80 TCP. 28 00:01:04,630 --> 00:01:06,970 ‫We can add more port mappings if you wanted to, 29 00:01:06,970 --> 00:01:09,523 ‫if more ports were exposed by wordpress. 30 00:01:10,370 --> 00:01:11,560 ‫Next for Environment variables, 31 00:01:11,560 --> 00:01:15,970 ‫you can either add them individually within both key value. 32 00:01:15,970 --> 00:01:18,210 ‫Or you can add them from a file, 33 00:01:18,210 --> 00:01:21,103 ‫and you specify them as an S3 bucket file. 34 00:01:22,160 --> 00:01:26,030 ‫And currently, because this UI is new for ECS, 35 00:01:26,030 --> 00:01:28,850 ‫then it does not allow you to specify environment variables 36 00:01:28,850 --> 00:01:31,140 ‫from the sequence manager 37 00:01:31,140 --> 00:01:33,220 ‫or the SSM prime manager store. 38 00:01:33,220 --> 00:01:35,360 ‫But you can do it using the older version 39 00:01:35,360 --> 00:01:37,760 ‫or the GSM form or CloudFormation. 40 00:01:37,760 --> 00:01:40,580 ‫And at some point I'm sure the UI will show a way 41 00:01:40,580 --> 00:01:42,560 ‫to take data and to inject variables. 42 00:01:42,560 --> 00:01:44,570 ‫Directly from the SSM prime manager store 43 00:01:44,570 --> 00:01:47,510 ‫and the secrets manager service. 44 00:01:47,510 --> 00:01:48,343 ‫So let's click on next. 45 00:01:48,343 --> 00:01:50,870 ‫So of course, I'm going to remove these. 46 00:01:50,870 --> 00:01:52,130 ‫Click on next. 47 00:01:52,130 --> 00:01:53,930 ‫Then you define the app environment. 48 00:01:53,930 --> 00:01:55,520 ‫So whether or not it can be launched 49 00:01:55,520 --> 00:01:57,760 ‫on Fargate or on Amazon EC2 instances. 50 00:01:57,760 --> 00:02:01,910 ‫So it's a type of launch type for ECS test definition. 51 00:02:01,910 --> 00:02:04,080 ‫Then the operating system, how much memory 52 00:02:04,080 --> 00:02:05,980 ‫and Ram you're going to need, memory 53 00:02:05,980 --> 00:02:08,810 ‫and CPU you're going to need for your containers. 54 00:02:08,810 --> 00:02:11,160 ‫And finally, if you want to have a task role. 55 00:02:11,160 --> 00:02:12,867 ‫So for example, if you want 56 00:02:12,867 --> 00:02:15,310 ‫to create a specific task role 57 00:02:15,310 --> 00:02:17,980 ‫that will allow your containers to make API request 58 00:02:17,980 --> 00:02:19,930 ‫to the different AWS services. 59 00:02:19,930 --> 00:02:22,783 ‫And then you can create your role and specify it here. 60 00:02:23,700 --> 00:02:25,210 ‫For storage, this is very important. 61 00:02:25,210 --> 00:02:26,180 ‫This is where for example, 62 00:02:26,180 --> 00:02:28,640 ‫you would set up a Bind mount, okay. 63 00:02:28,640 --> 00:02:30,290 ‫And you would give your volume name, 64 00:02:30,290 --> 00:02:31,950 ‫for example, DemoBind. 65 00:02:31,950 --> 00:02:34,910 ‫And here you would say how this volume is mounted 66 00:02:34,910 --> 00:02:36,700 ‫onto each of your containers. 67 00:02:36,700 --> 00:02:38,350 ‫And this will allow your containers 68 00:02:38,350 --> 00:02:40,710 ‫to communicate with one another. 69 00:02:40,710 --> 00:02:42,370 ‫So I'm going to remove this. 70 00:02:42,370 --> 00:02:45,290 ‫And then if you want to have monitoring and logging 71 00:02:45,290 --> 00:02:46,640 ‫so either you have a sidecar 72 00:02:46,640 --> 00:02:49,830 ‫or you can directly enable monitoring and logging directly 73 00:02:49,830 --> 00:02:51,420 ‫from the test definition 74 00:02:51,420 --> 00:02:54,000 ‫and you have some predefined log collection mechanism. 75 00:02:54,000 --> 00:02:56,480 ‫For example, CloudWatch is defined. 76 00:02:56,480 --> 00:02:57,550 ‫We can also send logs 77 00:02:57,550 --> 00:03:00,850 ‫to Firehose, Kinesis Stream, OpenSearch 78 00:03:00,850 --> 00:03:05,140 ‫or Amazon S3 via a service called FireLens. 79 00:03:05,140 --> 00:03:07,810 ‫Okay. You can also enable trace collection 80 00:03:07,810 --> 00:03:11,120 ‫to just get tracing data directly from x-ray 81 00:03:11,120 --> 00:03:13,440 ‫or metrics collection to send metrics 82 00:03:13,440 --> 00:03:17,970 ‫to either CloudWatch Prometheus in two different ways. 83 00:03:17,970 --> 00:03:19,110 ‫Okay. 84 00:03:19,110 --> 00:03:22,410 ‫Finally, you can tag your ECS test definition 85 00:03:22,410 --> 00:03:24,410 ‫if you're ever needed to. 86 00:03:24,410 --> 00:03:25,243 ‫Click on next. 87 00:03:25,243 --> 00:03:27,320 ‫And then you have seen all the parameters 88 00:03:27,320 --> 00:03:28,640 ‫for your test definition 89 00:03:28,640 --> 00:03:31,750 ‫and I hope that helps you understand the previous lecture. 90 00:03:31,750 --> 00:03:33,630 ‫Okay. That's it for this lecture. 91 00:03:33,630 --> 00:03:34,600 ‫I hope you liked it. 92 00:03:34,600 --> 00:03:36,553 ‫And I will see you in the next lecture.