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.
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.
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.
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.
In the AWS ECS interface
In the Create new Task Definitions interface
We configure task and container definitions
aws-fcj-task-def
For Add container
aws-fcj-container
5000