Create ECS Task definition

Create ECS Task definition

Fargate launch type use cases in Amazon ECS

Test environment

For test environments that don’t require too much workload, using the AWS Fargate serverless service instead of the EC2 instance service will help you get the most out of your resources.

Small workload environment, but occasional bursts

When the workload is small but sometimes there is an occasional spike, such as unexpected traffic or requests during the day and low at night, using the Fargate launch type will be more advantageous.

Because Fargate can scale up resources from a tiny container at night (extremely low cost) to respond to daytime spikes, just paying for CPU cores and GB of on-demand memory.

Workload is large, but does not want to consume resources for operation (Overhead cost)

Running a cluster of many EC2 instances takes a lot of work and time, as you must ensure patching, security, and updating to the latest versions of Docker and ECS Agent. At this point, Fargate will be the best choice!

The reason is that this serverless service is automatically protected by AWS engineers behind the scenes and patched and updated from the AWS infrastructure, without businesses having to worry.

Periodic Workload

When the system always has to run periodic tasks, such as cron jobs (hourly or occasionally) from the queue, AWS Fargate will provide the most stable support for the system. Instead of having to restart the EC2 instance after these tasks at runtime and still be billed while the EC2 instance is shutting down, Fargate is only charged while in runtime.

  1. In the AWS ECS interface

    • Select Task Definitions
    • Select Create new Task Definitions

ECS Lab

  1. In the Create new Task Definitions interface

    • For select launch type compatibility, select FARGATE
    • Select Next step

ECS Lab

  1. We configure task and container definitions

    • For Task definition name, enter aws-fcj-task-def

ECS Lab

  1. Select Task execution IAM role or create a new one
  • With Task size
    • Select Task memory(GB)
    • Select Task CPU (vCPU)
    • Select Add Container

ECS Lab

  1. For Add container

    • Container name, enter aws-fcj-container
    • Image, enter the image of ECR in the preparation step.
    • Port mappings, enter 5000
    • Select Add

ECS Lab

  1. Check again and select Create

ECS Lab

  1. Finish creating Task definitions

ECS Lab