在我的buildspec.yml文件中,aws ecs cli命令失败抛出"COMMAND_EXECUTION_ERROR: Error while command: aws ecs update --services xxxxx“。原因:退出状态255”
我已尝试使用"AmazonECS_FullAccess“策略为代码构建角色提供权限。
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker images...
- docker push $REPOSITORY_URI:latest
- docker push $REPOSITORY_URI:$IMAGE_TAG
- echo Writing image definitions file...
- printf '[{"name":"xxxxxxx","imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
- cat imagedefinitions.json
- echo Updating ECSfargate service ...
- aws ecs describe-services --services xxxxxxxxxxxxxxxxx
- aws ecs update-service --service xxxxxxxxxxxxxxxxx --desired-count 2 --no-force-new-deployment
发布于 2020-02-19 15:18:52
附加AmazonEC2ContainerRegistryPowerUser
的策略为我修复了此问题。
发布于 2019-09-26 09:01:25
错误代码255表示:
255 --命令失败。CLI或向其发出请求的服务引发了错误。
https://docs.aws.amazon.com/cli/latest/topic/return-codes.html
正如您提到的,您已经提供了对CB角色的完全ECS访问权限,接下来您可以检查命令失败的原因:它是在ecs describe还是ecs update-service上失败?因为如果Fargate Service没有稳定下来,它将导致错误255。
我建议:
1)只需保留ecs describe命令,看看该命令是否有效。
2)如果(1)成功,则执行ecs更新服务,并在AWS ECS控制台和/或CW日志组中监控该服务(如果您的Fargate Taskdef具有logGroup条目)。
发布于 2021-03-09 17:35:27
您需要将管道的权限GetAuthorizationToken授予
ecr:*
而不是
ecr:repository/<you_repo>
因为
aws ecr get-login-password --region <aws_region>
对其执行
<account_id>.dkr.ecr.<aws_region>.amazonaws.com
而不是反对
<account_id>.dkr.ecr.<aws_region>.amazonaws.com/repository/<your_repo>
https://stackoverflow.com/questions/58100966
复制相似问题