Hands-on: Setup AWS ECR, ECS and Fargate for NodeJS Application in a Docker Image

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello my name is Adam and I'm pretty sales consultant at stormy stormy is an AWS select Consulting partner can help you make the most of what AWS cloud has to offer today we will take a look at the demo in AWS Management console with the AWS elastic container registry elastic container service and AWS far gate this will be a very simple serverless infrastructure that will help us deploy our node.js application to the AWS Cloud so here we have our simplified diagram I have my node.js application in a Docker image and we will create an elastic container registry where we will store our image and then we will load this into ECS where we will create a task with AWS fargate to run our application this is a serverless infrastructure and after we will create everything you don't have to manage any servers just provide your updated code and redeploy it in ECS I will start in Visual Studio because I have my code here my node.js code that is ready to be deployed it's very simple code with Hello World from AWS firegate and it works through Port 80 so we will need to open that in our Docker Docker file and also in AWS my Docker file is also already so we are basically ready to deploy this somewhere we will use AWS ECS and ECR what we need to get ready first is ECR so we are going to AWS Management console for this as a first thing we go to plastic container registry to create our first repository here I'm in the Frankfurt region but it doesn't matter which region you want to use we will do that by clicking on get started our repository can be private it's not necessary to create this repository publicly I will create my repository so it will be stormy demo and it can be node.js application we can scan on push here we can leave everything else on the file and click on create our first Repository and our repository is ready we can go to our repository name and click on view push commands and if you if you are not already using AWS CLI you will need it for this it's possible to do that by simply going through some AWS documentation which I already gave you in this the description of this video so you can click on that and go through it and pretty quickly create the AWS CLI login and everything what you need I will use the first code to log into my new ECR repository and go to my you can run a new terminal here we will paste our first code here and run it and I'll log into ECR was successful and I will go back to AWS console and copy the second code to create my new Docker image the right name okay so click on that it will take a couple of seconds and our Docker Docker image is created I will go back and copy the third code which will tag our image and click on here and copy the last code and paste it here again and it will push our Docker image to my ECR repository so it can take a couple of seconds or minutes I will wait till it's done after a couple of seconds it's pushed to our repository so we can go back to AWS Management console and close close some panels here you can click on our repository name and we should see our first image here so it's ready to be deployed on ECS so we can go to ECS what's the container service and the first thing what I want to do I will use today a new ECS experience so basically a new console for this I will click on get started with our container reset application we will click on create cluster so we will create a new cluster with our name so it can be against install mighty demo node.js up for instance we can use the default VPC if if you want to use any other settings or anything like that you can I'm in the Frankfurt region so there are three azs there I will use or three it's not a problem we will use AWS fargate serverless and [Music] I think it's a new way and very good way to deploy these applications it's all serverless and we will click on create and our cluster will be deployed after couple of seconds you can go back to cloud formation and check there everything what you will create in ECS will be also there in cloud formation in your region after couple of minutes our cluster is ready we can go to our cluster and check if it's if it's still provisioning but it's fine we can Define our task here this is where we will need our ECR repository so I will click on create new task definition it will be again stormy demo and node.js up Blocker we can write okay here and as you can see we will need the URI of our ECR repository so I will open a PCR in a new tab and it's right here URI it's everything would be your need again we can write like JS or something like that and here we have to choose the container Port we are using the simple HTTP protocol for this if you need any other board mappings you can just write it here and it will be ready for you we need just one container because we have only one application we can click on next and we will use the AWS fargate serverless okay it's ready the Linux operation system we can use only two gigabytes of memory it doesn't matter at this moment you can choose everything anything what you will need if you don't see the task execution role here you can create a new role it should be very simple but I don't know if this is ready just for me or it will be for you we will use this default amount of storage so 20 Gigabytes and yes we can monitor our lock in Amazon cloudwatch and click on next and there is only a review and we can click on create our first task definition it should take only a couple of seconds or a minute so I will just wait and our task is ready so we can go to our clusters again and to my cluster and we can deploy or we can deploy a service here so we can just run it like this we can use the launch type here and launch type will be far guide and platform service yes we want to use the latest version we can use the service here and the family which is basically our task and the revision is lightest so we start we can leave the replica here and the second thing which needs to do which needs to be defined is our security group because I think that the existing group we don't know what it will does and we will need to open day 80 port for HTTP so we will create a new Security Group it can be or can launches apps performance or something like that and the description open for 50. for http and we will add new row for HTTP protocol and the source will be anywhere because we want to connect to this container or this repository and plastic container service through the internet yes we want the public IP address and the load balancing here we will leave that for now but I will go back or create a new new task and and new deployment for this I will click on deploy then I think there is yes we will need some name so we will just choose like this it doesn't matter and we will deploy it and as you can see again it's deploying by cloud formation so you can always go there and check that I will just wait here and our service and tasks are deployed we can go to tasks and go to my task here and as you can see we have a public IP here which we can use and it should work and as you can see our service is working fine on Port 80 on our one instance at this moment so we will go and create a application load balancer so we will go back to clusters to my cluster and you can delete this service right now you don't need that anymore and we will deploy a new service and it will be capacity provider and service you choose revision one and the family or these tasks okay and what we want to do we want to use application load balancer we will create a new one this will create a new load balancer so we can use more AWS fargate instances behind it we can name it node.js up or something like that yes this will be okay yes we want to create a new listener for Port 80 if you are doing another application with some different ports you can just create a new listener here and check this if it's fine and yes we want to create a new Target group and it will be our again until there is a lot of names here but at this moment it doesn't matter yes we can check the health of our resources behind it you can leave that in the file and yes we can use service auto scaling here we can use a minimum number of tasks and okay we can use two and maximum number of tasks for policy name will be let's scale or forget instances and the target value of CPU utilization we can leave that on 70 percent and deploy our new service for this I think let me just okay so we can leave it on one for now we have something else again stormy they're more just just to know what is it and click on deploy and again it we have to run through cloud formation so it takes a couple of seconds or minutes and our service um tasks are ready after a couple of seconds again we can go back to tasks and as you can see you are my stupid task and here is a new one I will click on that and as you can see here is a public IP again I can try to open it and it should work but we will need the application load balancer IP and we will need to find this in the different tab it will be on services and our service is here and if you look at here you can click and open your own balancer but it is also visible in networking and here is our domain name here so I can open it and as you can see it also works so this is our load balancer and and our application it should be done at this moment we can go back to my presentation thank you for watching if you want to see more videos about AWS Services subscribe to our Channel or if you want to learn more about other services visit our website and blog links are in the description below and if you have any questions don't hesitate to contact us
Info
Channel: StormIT
Views: 10,565
Rating: undefined out of 5
Keywords: docker ecs fargate, nodejs ecs, nodejs fargate, docker ecs, ecs fargate ecr, elastic container service, aws containers, ecs tutorial, ecs ecr tutorial, begin ecs ecr fargate, aws fargate and ecs, aws ecs, aws ecr, docker in aws, serverless docker aws, alb ecs fargate, application load balancer fargate, elastic container registry, new ecs console, nodejs in aws, aws ecs fargate tutorial, ecs ecr fargate, creating ecs cluster
Id: RgLt3R2A20s
Channel Id: undefined
Length: 16min 4sec (964 seconds)
Published: Thu Dec 08 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.