ecs service multiple target group
2022. 10. 25. 09:12ㆍAWS/Amazon Elastic Container Service
728x90
SMALL
- 개요
ECS Service에 다중 LB 및 TG 를 사용이 요구 되는 경우는 종종 있다. Internal & External 을 사용하는 경우가 대표적이다. 그럴 경우 콘솔에서는 안되지만 CLI, SKD 등을 사용해서 생성이 가능하다. ECS Service에 TG를 여러 개 붙히려고 한다면 AWS Web Console에서는 불가능하여 CLI로 하는 방법을 정리했다.
- 방법
aws ecs update-service --cluster <ecs-cluster> --service <service> --cli-input-json file://service.json
# service.json
{
"cluster": "<ecs-cluster>",
"service": "<ecs-service>",
"desiredCount": <number>,
"taskDefinition": "<taskdefinition>",
"loadBalancers": [
{
"targetGroupArn": "<tg-arn-1>",
"containerName": "<container>",
"containerPort": <port>
},
{
"targetGroupArn": "<tg-arn-2>",
"containerName": "<container>",
"containerPort": <port>
}
],
"deploymentConfiguration": {
"maximumPercent": <percent>,
"minimumHealthyPercent": <percent>
},
"networkConfiguration": {
"awsvpcConfiguration": {
"subnets": [
"<subnet-yyyy>",
"<subnet-xxxx>"
],
"securityGroups": [
"<sg-12343245235>"
],
"assignPublicIp": "ENABLED"
}
},
"forceNewDeployment": false,
"healthCheckGracePeriodSeconds": <seconds>
}
- 참고
To create a service specifying multiple target groups, you must create the service using the Amazon ECS API, SDK, AWS CLI, or an AWS CloudFormation template. After the service is created, you can view the service and the target groups registered to it with the AWS Management Console. You must use UpdateService to modify the load balancer configuration of an existing service.
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/register-multiple-targetgroups.html
728x90
LIST
'AWS > Amazon Elastic Container Service' 카테고리의 다른 글
교차 계정에서 AWS ECR 제어 (0) | 2023.12.29 |
---|---|
Amazon ECS new Web Console에서는 안 되는 작업들 (0) | 2023.10.13 |
ecs fargate Deployment failure detection (0) | 2023.06.21 |
Cloudformation Stack ECS-Console-V2-Service-xxxxxxxx ECS-Console-V2-Cluster-xxxxxxxx (0) | 2023.01.27 |
Unable to update platform version on services with a CODE_DEPLOY deployment controller. Use AWS CodeDeploy to trigger a new deployment (0) | 2022.11.29 |