How to create a container in AWS Fargate

In this article, let's dive into how to create an AWS Fargate container using the Amazon Web Services (AWS) Management Console. AWS Fargate is an Amazon service that uses Elastic Container Service (ECS) and Elastic Kubernetes Service (EKS). With Fargate, administrators don't mess with provisioning and scaling workloads. Fargate lets administrators work only with the workloads themselves. No more messing around with management servers and Elastic Compute Cloud (EC2) clusters!

Prerequisites ^

Fargate manages the majority of the infrastructure, so prereqs are limited. You'll need:

  • An AWS account with an Identity & Access Management (IAM) user and security group set up with appropriate ECS permissions
  • The AWS Management Console region set to either Northern Virginia, Ohio, Oregon, or Ireland—these are the only regions Fargate is currently available in

Getting started ^

The first step to create a Fargate container is to run the ECS First Run Wizard. Using this wizard is a quick and easy way to set up a container with the appropriate containers, roles, and user permissions.

If you want to follow along, sign into your AWS account and run the AWS ECS First Run Wizard. This link is for the us-east-2 (Ohio) region, so if you need to change regions to where you have any additional infrastructure set up, do so before proceeding.

Container definition ^

We first need to create our container. Since this is a fresh environment, and because image creation is out of scope for this document, we'll select the nginx prebuilt image.

Selecting nginx in the AWS ECS first run

Selecting nginx in the AWS ECS first run

Task definition ^

Next, we need to specify the task definition. We'll call our task the fargate-first-run-task, and we can also specify the task's memory and processor settings. Click Edit next to the Task definition subheading to specify the task settings.

Task setting specification

Task setting specification

Configure service ^

Next up, we can specify settings like the target number of tasks to run at the same time, the security group, IP range, and so on. Once you're satisfied, click Save to create the service.

Service creation

Service creation

Configure cluster ^

Lastly, we configure the Fargate cluster. There's no need to create any specific virtual private clouds (VPCs) here. It will automatically create everything for you. I'm going to rename my cluster since I'd like to keep the cluster created in this walkthrough separate from other clusters. After naming it, we can click Next to reach the last step of our first run before clicking Create.

Cluster naming and creation

Cluster naming and creation

After we click Create, we can watch our services spin up.

Fargate deployment

Fargate deployment

Once this step is complete, our Fargate container is created! We can now monitor the services. There you have it! You've configured and run your very first Fargate container. To monitor the number of running services, you can enter the AWS Elastic Container Service section in the Management Console to see the actual cluster built.

Viewing your Fargate deployment ^

Under the Elastic Container Service menu, you can select the Task Definitions submenu to view the task you just created.

Task Definitions menu

Task Definitions menu

By selecting your task, you can review all the information about the task you created. You can see the task size and any required attributes. You can even view the JSON configuration for the task if you wanted to copy it and use it for additional configurations via the command line later on.

Summary ^

By using Fargate to launch containers, administrators save a ton of time with infrastructure, and as you've seen, it makes bringing up containers seamless. For more introductory information on getting started with AWS Fargate, check out Introducing Fargate – Run Containers without Managing Infrastructure.

Want to write for 4sysops? We are looking for new authors.

Read 4sysops without ads and for free by becoming a member!


Leave a reply

Your email address will not be published. Required fields are marked *


© 4sysops 2006 - 2020


Please ask IT administration questions in the forums. Any other messages are welcome.


Log in with your credentials


Forgot your details?

Create Account