![](/img/trans.png)
[英]How to add target group from different AWS VPC and region to a AWSALB?
[英]ECS Service can't attach target group from different region
我有一個 ECS 服務,我想將兩個負載均衡器附加到該服務上,其中一個負載均衡器位於 ECS 集群的不同區域。 當我嘗試應用更改時,出現以下錯誤。
InvalidParameterException: Unable to assume role and validate the specified targetGroupArn. Please verify that the ECS service role being passed has the proper permissions.
這是我正在使用的 terraform 代碼和 terraform 計划的 output:
resource "aws_ecs_service" "monitoring_grafana_service" {
name = "grafana"
cluster = module.ecs.ecs_cluster_arn
task_definition = aws_ecs_task_definition.monitoring_grafana_task.arn
desired_count = 1
network_configuration{
subnets = module.monitoring_vpc.private_subnets
security_groups = [ module.grafana_sg.security_group_id ]
}
load_balancer {
target_group_arn = module.frontend_alb.target_group_arns[0]
container_name = "grafana"
container_port = 3000
}
load_balancer {
target_group_arn = data.terraform_remote_state.ireland_vpc.outputs.oss_target_group_arns[0]
container_name = "grafana"
container_port = 3000
}
lifecycle {
ignore_changes = [
capacity_provider_strategy
]
}
}
Output:
+ load_balancer {
+ container_name = "grafana"
+ container_port = 3000
+ target_group_arn = "arn:aws:elasticloadbalancing:eu-central-1:myAcc:targetgroup/grafna20220202125410761200000016/1cdafdd8e73c1d9a"
}
+ load_balancer {
+ container_name = "grafana"
+ container_port = 3000
+ target_group_arn = "arn:aws:elasticloadbalancing:eu-west-1:myAcc:targetgroup/grafna20220203130531009700000004/ff91959dcf50287e"
}
ECS 使用的服務角色是“默認”角色,由 AWS 創建。 它具有 AWS 托管策略:AmazonECSServiceRolePolicy
事實證明,ECS 不支持此功能。 (2021 年 2 月)
集群是特定於區域的。 這可能是原因。
網絡負載均衡器現在支持從客戶端連接到跨不同 AWS 區域的對等 VPC 中基於 IP 的目標。
確保您的 VPC 已與目標資源建立對等連接
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-load-balancing.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.