ECS Service Deploy Error: ECS Deployment Circuit Breaker was triggered

0

Hi AWS, I am creating an ECS Service and while doing that I am getting the error: Resource handler returned message: "Error occurred during operation 'ECS Deployment Circuit Breaker was triggered'." (RequestToken: 8d5f80cb-c2d8-e7fc-ff9e-1d221362973b, HandlerErrorCode: GeneralServiceException) as attached in the screenshot below.

ECS Service CloudFormation Error

Here is the JSON code for task definition file:

{
    "taskDefinitionArn": "arn:aws:ecs:us-east-1:123456789012:task-definition/aws-ecs-docker:1",
    "containerDefinitions": [
        {
            "name": "exp-code-pipeline",
            "image": "123456789012.dkr.ecr.us-east-1.amazonaws.com/ecs-docker-demo:latest",
            "cpu": 0,
            "portMappings": [
                {
                    "name": "exp-code-pipeline-80-tcp",
                    "containerPort": 80,
                    "hostPort": 80,
                    "protocol": "tcp",
                    "appProtocol": "http"
                }
            ],
            "essential": true,
            "environment": [],
            "environmentFiles": [],
            "mountPoints": [],
            "volumesFrom": [],
            "ulimits": [],
            "logConfiguration": {
                "logDriver": "awslogs",
                "options": {
                    "awslogs-group": "/ecs/aws-ecs-docker",
                    "awslogs-create-group": "true",
                    "awslogs-region": "us-east-1",
                    "awslogs-stream-prefix": "ecs"
                },
                "secretOptions": []
            },
            "systemControls": []
        }
    ],
    "family": "aws-ecs-docker",
    "executionRoleArn": "arn:aws:iam::123456789012:role/ecsTaskExecutionRole",
    "networkMode": "awsvpc",
    "revision": 1,
    "volumes": [],
    "status": "ACTIVE",
    "requiresAttributes": [
        {
            "name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
        },
        {
            "name": "ecs.capability.execution-role-awslogs"
        },
        {
            "name": "com.amazonaws.ecs.capability.ecr-auth"
        },
        {
            "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
        },
        {
            "name": "ecs.capability.execution-role-ecr-pull"
        },
        {
            "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
        },
        {
            "name": "ecs.capability.task-eni"
        },
        {
            "name": "com.amazonaws.ecs.capability.docker-remote-api.1.29"
        }
    ],
    "placementConstraints": [],
    "compatibilities": [
        "EC2"
    ],
    "requiresCompatibilities": [
        "EC2"
    ],
    "cpu": "1024",
    "memory": "1024",
    "runtimePlatform": {
        "cpuArchitecture": "X86_64",
        "operatingSystemFamily": "LINUX"
    },
    "registeredAt": "2024-06-11T08:13:42.129Z",
    "registeredBy": "arn:aws:iam::123456789012:user/devsecops-iam-user",
    "tags": []
}

I have checked the error logs in CloudWatch Log Group as well but didn't find any and I am attaching the screenshot below for the same.

ECS Service CloudWatch Log Group

I have checked the Dockerfile and tried to create a docker image locally and it worked fine but just pasting the code to review it once if there is any error:

FROM --platform=linux/amd64 node:18-alpine
WORKDIR /app
COPY . .
RUN yarn install
CMD ["node", "index.js"]
EXPOSE 3000

I have also followed the repost link https://repost.aws/questions/QU5nk1tyN_TpWbKm85LdWGgA/resource-handler-returned-message-ecs-deployment-circuit-breaker-was-triggered-handlererrorcode-generalserviceexception, but no luck.

Please advise.

profile picture
質問済み 5ヶ月前624ビュー
1回答
3

Hello Arjun,

Here issue shows "ECS Deployment Circuit Breaker was triggered" indicates ECS stopped deploying your service due to repeated failures.

  • Check ECS cluster and task logs, not just CloudWatch logs, for detailed failure messages.

  • Verify your container has a health check defined to avoid triggering failures.

Check Port Mappings: Ensure your container port matches your application port (e.g., if your app runs on port 3000, set containerPort and hostPort to 3000 in the task definition).

Verify Logs: Review ECS task and container logs in CloudWatch for errors.

Increase Resources: Ensure the CPU and memory settings in the task definition are sufficient for your application.

Network Configurations: Check VPC, subnets, and security groups to ensure proper network configurations.

Edit the Container Definition

  • In the "Container Definitions" section, click "Edit" next to the container you want to modify.

  • Scroll down to the "Port mappings" section.

Example of corrected port mappings in your task definition:

"portMappings": [
    {
        "containerPort": 3000,
        "hostPort": 3000,
        "protocol": "tcp"
    }
]

profile picture
エキスパート
回答済み 5ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ