无法使用 Application Load Balancer 在 Amazon ECS 中创建服务。没有给出错误信息
Unable to create service in Amazon ECS using Application Load Balancer. No error message given
我正在尝试在带有应用程序负载均衡器的 ecs 集群上创建一个服务,以 运行 具有两个容器、api 和 redis 的任务定义。当我尝试创建服务时出现错误 "Failed creation of service /n Service creation failed:",它没有提供任何有关错误的信息。
我希望该服务通过让该服务为我创建一个新的目标组来自动注册我的 ecs ec2 的正确端口。我的 api 容器有主机端口:0,容器端口:3000。我的 redis 容器有主机端口:0 和容器端口:6379,都使用 tcp。
我将在下面粘贴我的服务配置的文本版本。
Review
Cluster: rest-api-explorer
Launch type: EC2
Task Definition: rest-api-explorer:19
Service name: rest-api-service
Service type: DAEMON
Minimum healthy: percent 0
Maximum percent: 100
Configure network
Health check grace period: 10
Container Name: api-rest-explorer
Container Port: 3000
ELB Name: rest-api-explorer
Target Group: ecs-created-rest-api-service
Health Check Path: /api/rest/console
Listener Port: 3000
Path-pattern: /api/rest/console
Service Role: AWSServiceRoleForECS
Set Auto Scaling (optional)
not configured
在尝试使用 aws cli 启动服务后,我发现这是一个与 iam 权限相关的问题。经验教训是 aws cli 比控制台更适合获取错误消息。
要解决此问题,只需将以下策略添加到您的 IAM 用户
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iam:GetRole",
"iam:PassRole"
],
"Resource": "ROLE_ARN"
}
]
}
我正在尝试在带有应用程序负载均衡器的 ecs 集群上创建一个服务,以 运行 具有两个容器、api 和 redis 的任务定义。当我尝试创建服务时出现错误 "Failed creation of service /n Service creation failed:",它没有提供任何有关错误的信息。
我希望该服务通过让该服务为我创建一个新的目标组来自动注册我的 ecs ec2 的正确端口。我的 api 容器有主机端口:0,容器端口:3000。我的 redis 容器有主机端口:0 和容器端口:6379,都使用 tcp。
我将在下面粘贴我的服务配置的文本版本。
Review
Cluster: rest-api-explorer
Launch type: EC2
Task Definition: rest-api-explorer:19
Service name: rest-api-service
Service type: DAEMON
Minimum healthy: percent 0
Maximum percent: 100
Configure network
Health check grace period: 10
Container Name: api-rest-explorer
Container Port: 3000
ELB Name: rest-api-explorer
Target Group: ecs-created-rest-api-service
Health Check Path: /api/rest/console
Listener Port: 3000
Path-pattern: /api/rest/console
Service Role: AWSServiceRoleForECS
Set Auto Scaling (optional)
not configured
在尝试使用 aws cli 启动服务后,我发现这是一个与 iam 权限相关的问题。经验教训是 aws cli 比控制台更适合获取错误消息。
要解决此问题,只需将以下策略添加到您的 IAM 用户
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iam:GetRole",
"iam:PassRole"
],
"Resource": "ROLE_ARN"
}
]
}