ECS fargate service with ALB deployed using CDK

0

This is my first time trying to use CDK to deploy a Fargate service stack with an ALB configured in a separate stack. I tried to follow this example https://github.com/aws-samples/aws-cdk-examples/blob/master/typescript/ecs/cross-stack-load-balancer/split-at-listener.ts

Note: By itself the task definition and the service is getting deployed perfectly, however when I try to add a listener/target group and register the service with the target group then it fails with this error.

Resource handler returned message: "Invalid request provided: UpdateService error: Health check grace period is only valid for services config
ured to use load balancers (Service: AmazonECS; Status Code: 400; Error Code: InvalidParameterException; Request ID: c49473d9-f5d1-47c2-b113-3
0551d484d3f; Proxy: null)" (RequestToken: e68aef9e-ed8f-8d28-d29c-fec52c7339e0, HandlerErrorCode: InvalidRequest)
질문됨 2년 전2033회 조회
1개 답변
0

Can you check whether the service you created is using load balancing or not?

You cannot update an ECS service whether or not to use load balancing.

If you want to change it (i.e. from non-load balancing to load balancing or vice-versa), you need to re-create the service.

https://docs.aws.amazon.com/AmazonECS/latest/userguide/service-load-balancing.html#load-balancing-considerations

You cannot add, remove, or change the load balancer configuration of an existing service.

답변함 2년 전
  • Thanks for your response.. Yeah, so I have been adding resources in this stack one at a time. I started with taskDefinition, then FargateService (started with just 1 desired count) with appropriate taskRole and executionRole. Once this deployed successfully I started adding ALB/TG connection. Basically I imported ALB and added listener/targetGroup... I guess it does not like this approach. Based on your response I thought let me delete the stack and recreate with all the resources that I need, and it appears to help.. Now I am further along.. the necessary plumbing between ALB/Listener/TG/Service seems to have been made.. Now the failure is that TargetGroup does not have healthy targets. I wonder if its the security group issue.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠