我正在尝试通过 aws cli 将容器部署到 ECS(Fargate)。我能够成功创建任务定义,当我想向 Fargate 集群添加新服务时出现问题。
这是执行的命令:
aws ecs create-service --cli-input-json file://aws_manual_cfn/ecs-service.json
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误:
An error occurred (InvalidParameterException) when calling the CreateService operation: You cannot specify an IAM role for services that require a service linked role.`
Run Code Online (Sandbox Code Playgroud)
ecs-service.json
{
"cluster": "my-fargate-cluster",
"role": "AWSServiceRoleForECS",
"serviceName": "dropinfun-spots",
"desiredCount": 1,
"launchType": "FARGATE",
"networkConfiguration": {
"awsvpcConfiguration": {
"assignPublicIp": "ENABLED",
"securityGroups": ["sg-06d506f7e444f2faa"],
"subnets": ["subnet-c8ffcbf7", "subnet-1c7b6078", "subnet-d47f7efb", "subnet-e704cfad", "subnet-deeb43d1", "subnet-b59097e8"]
}
},
"taskDefinition": "dropinfun-spots-task",
"loadBalancers": [
{
"targetGroupArn": "arn:aws:elasticloadbalancing:us-east-1:************:targetgroup/dropinfun-spots-target-group/c21992d4a411010f",
"containerName": "dropinfun-spots-service",
"containerPort": 80
}
]
} …Run Code Online (Sandbox Code Playgroud)