1 00:00:00,500 --> 00:00:01,333 ‫Now let's talk 2 00:00:01,333 --> 00:00:02,830 ‫about a few solution architectures 3 00:00:02,830 --> 00:00:05,550 ‫you can encounter with Amazon ECS. 4 00:00:05,550 --> 00:00:09,380 ‫So the first one are ECS task invoked by EventBridge. 5 00:00:09,380 --> 00:00:10,213 ‫So for example, 6 00:00:10,213 --> 00:00:13,360 ‫say we have an Amazon ECS cluster it's backed by fargates 7 00:00:13,360 --> 00:00:15,020 ‫and with the S3 buckets. 8 00:00:15,020 --> 00:00:18,920 ‫Our users are going to upload objects into S3 buckets. 9 00:00:18,920 --> 00:00:21,330 ‫And these S3 buckets can be for example 10 00:00:21,330 --> 00:00:23,430 ‫integrated with Amazon EventBridge 11 00:00:23,430 --> 00:00:25,530 ‫to send all the events to it. 12 00:00:25,530 --> 00:00:28,850 ‫And Amazon EventBridge can have a rule to run 13 00:00:28,850 --> 00:00:30,950 ‫ECS tasks on the go. 14 00:00:30,950 --> 00:00:33,160 ‫Now ECS tasks are going to be created. 15 00:00:33,160 --> 00:00:36,090 ‫They will have an ECS task role associated with them. 16 00:00:36,090 --> 00:00:37,370 ‫And from the task itself, 17 00:00:37,370 --> 00:00:41,460 ‫what it can do is that it can get the objects, process it 18 00:00:41,460 --> 00:00:45,150 ‫and then send the results into Amazon DynamoDB. 19 00:00:45,150 --> 00:00:46,440 ‫And that is thanks to the fact 20 00:00:46,440 --> 00:00:49,300 ‫that we have an ECS task role associated with it. 21 00:00:49,300 --> 00:00:51,270 ‫And so effectively here, what we've done is 22 00:00:51,270 --> 00:00:54,370 ‫that we've created a serverless architecture 23 00:00:54,370 --> 00:00:58,030 ‫to process images or to process objects 24 00:00:58,030 --> 00:01:01,500 ‫from your S3 buckets using a Docker container. 25 00:01:01,500 --> 00:01:03,585 ‫And that is using Amazon EventBridge, 26 00:01:03,585 --> 00:01:06,300 ‫ECS find the fargate mode, 27 00:01:06,300 --> 00:01:09,790 ‫as well as an ECS task role to talk to Amazon S3 28 00:01:09,790 --> 00:01:12,110 ‫and Amazon DynamoDB. 29 00:01:12,110 --> 00:01:14,860 ‫Another architecture using again EventBridge 30 00:01:14,860 --> 00:01:16,870 ‫is to use an EventBridge schedule. 31 00:01:16,870 --> 00:01:19,720 ‫So we have an Amazon ECS cluster backed by fargates 32 00:01:19,720 --> 00:01:21,230 ‫and Amazon EventBridge. 33 00:01:21,230 --> 00:01:25,080 ‫And we schedule a rule to be triggered every one hour. 34 00:01:25,080 --> 00:01:29,090 ‫Now this rule is going to run ECS tasks for us in fargates. 35 00:01:29,090 --> 00:01:31,350 ‫And so that means that everyone hour 36 00:01:31,350 --> 00:01:33,930 ‫a new task will be created in our fargate cluster. 37 00:01:33,930 --> 00:01:35,730 ‫And the tasking can do whatever we want. 38 00:01:35,730 --> 00:01:38,430 ‫For example, we can create an ECS task role 39 00:01:38,430 --> 00:01:40,310 ‫with access to Amazon S3 40 00:01:40,310 --> 00:01:43,560 ‫and therefore our task, our Docker container, 41 00:01:43,560 --> 00:01:46,910 ‫our program can for example, do every one hour 42 00:01:46,910 --> 00:01:50,850 ‫some batch processing against some files in Amazon S3. 43 00:01:50,850 --> 00:01:55,250 ‫And again, all of that architecture is fully serverless. 44 00:01:55,250 --> 00:01:58,510 ‫Our last example is using ECS-SQS Queue. 45 00:01:58,510 --> 00:02:03,010 ‫So we could have a service on ECS with two ECS tasks 46 00:02:03,010 --> 00:02:05,700 ‫and message are being sent into an SQS Queue 47 00:02:05,700 --> 00:02:08,110 ‫and the service itself is polling 48 00:02:08,110 --> 00:02:11,630 ‫for messages from the SQS Queue and processing them. 49 00:02:11,630 --> 00:02:14,060 ‫We can enable ECS service auto scaling 50 00:02:14,060 --> 00:02:15,520 ‫on top of this service. 51 00:02:15,520 --> 00:02:16,780 ‫That means that for example, 52 00:02:16,780 --> 00:02:19,550 ‫the more messages we have in our SQS Queue, 53 00:02:19,550 --> 00:02:23,134 ‫the more tasks we're going to have into our ECS service, 54 00:02:23,134 --> 00:02:25,270 ‫thanks auto scaling. 55 00:02:25,270 --> 00:02:28,140 ‫Okay, that was it for some architectures on ECS. 56 00:02:28,140 --> 00:02:29,410 ‫I hope that makes sense. 57 00:02:29,410 --> 00:02:31,360 ‫And I will see you in the next lecture.