Eric Stevens: In this video, we'll demo how to use
Amazon's managed container service Fargate. We'll
open up the ECS service in the Manager Console.
Then click Get Started. We'll start by configuring
our container definition. Our container definition
will identify what image our container will use
and its resources. Let's go ahead and click on the
sample app, then edit. Here we can provide the
name of our container and also the image name. In
this demo, we're using the built in HTTP D image,
but you could also use an image from any container
repository.
Next we'll set the memory limits for our container
definition. You can set a soft limit, a hard limit,
or both. A soft limit will allocate memory resources
for your container. A hard limit, if reached
will kill your container. we'll leave the soft
limit set to 512. Finally, we'll configure our port
mappings. This is the port that our container
will be listening on. And because we're doing HTTP D,
we'll use the standard HTTP port of 80.
Click Update. With our container definition complete,
let's go ahead and configure our task definition.
A task definition logically groups together
containers for each application. So scroll down
to task definition and click Edit. Here, first
we'll set our definition name. Let's call this
ourWebApp. We're using Fargate, so our network
mode will always be AWSVPC. This means we can use
security groups and other VPC network tools to
interact with our container.
Next, we'll identify what role we want our task
execution policy to run under. We'll go ahead and
create a new role. Finally, we'll need to set the
task memory and task CPU numbers. Remember, a task
can be an entire application, so it may have many
containers inside of it. So, make sure you size it
appropriately. We'll leave our memory at a half a
gig, and our CPU at a quarter of the vCPU. We'll
click Next. Next, we'll edit our service settings.
Here, we could specify a desired number of tasks.
And the service will ensure it has at least that
many running. Fargate will create a security group
for us that we can use to apply firewall rules
with. And optionally, we can add an application
load balancer if we need high availability. Let's
click Next.
Finally, we'll define the cluster that our
services running on top of. We can call this our
demo cluster. This will create a VPC for us, and
subnets. We could put additional services in this
same cluster. Finally, we'll review our settings
and click Create. After all your creation steps
are completed, click View Service. Here, we can
find all the details about our service. And if we
want to validate it's working, we can click on
tasks, see that we have one task running and go
ahead and click on it's ID. Then if we scroll down
to the bottom, we can see the public IP address.
And we can paste that into our browser URL. Great,
we have an application and a container up and
running in Amazon Fargate. Thanks for watching.