Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What should I do when Fargate runs out of capacity?

I'm kicking off a single ECS Fargate task with a command such as:

aws ecs run-task --cluster Fargate \
 --task-definition $ECR_REPO-run-setup 
 --overrides file:///tmp/ecs-overrides-db-migrate.txt \
 --count 1 --launch-type FARGATE \
 --network-configuration "awsvpcConfiguration={subnets=[$PUBLIC_SUBNET_1, $PUBLIC_SUBNET_2],securityGroups=[$FARGATE_SG],assignPubli cIp=ENABLED}"

There are no ECS services, tasks or instances at all running in my account at the moment. This is the response I get back:

{
    "failures": [
        {
            "reason": "Capacity is unavailable at this time. Please try again later or in a different availability zone"
        }
    ],
    "tasks": []
}

I don't even see a way to specify a different availability zone for a Fargate Task?

If I should just retry, how long should I wait before retries?

like image 289
Ryan Shillington Avatar asked Mar 21 '18 19:03

Ryan Shillington


People also ask

What do you have to manage when running fargate on ECS?

ECS with AWS Fargate Users create a cluster, add workloads to it and specify resource requirements (CPU and memory), and when ECS containers are deployed, Fargate will launch, run and manage pre-configured servers that meet container requirements.

What is ephemeral storage in fargate?

PDFRSS. When provisioned, each Amazon ECS task that are hosted on AWS Fargate receives the following ephemeral storage for bind mounts. This can be mounted and shared among containers that use the volumes , mountPoints , and volumesFrom parameters in the task definition.

Can you reuse fargate containers?

As IT teams gain experience running containerized applications, they can extend Fargate deployments to ECS -- and eventually EKS -- for cluster management, all with the comfort of knowing they can reuse these task configurations to gain more resource options and control.


1 Answers

Withing a VPC you can create one or more subnets that correspond to an availability zone.

When launching your Fargate task you will notice the network-configuration parameter and associated awsvpcConfiguration. To specify multiple zones you can pass in multiple subnets. For example:

aws ecs run-task --cluster Fargate \
 --task-definition $ECR_REPO-run-setup 
 --overrides file:///tmp/ecs-overrides-db-migrate.txt \
 --count 1 --launch-type FARGATE \
 --network-configuration "awsvpcConfiguration={subnets=[$MY_SUBNET_IN_AZ1, 
$MY_SUBNET_IN_AZ2]

The VPC documentation in aws contains more helpful information: https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html#vpc-subnet-basics

like image 105
Roy Kachouh Avatar answered Sep 29 '22 11:09

Roy Kachouh