Coudebuild Fails in PRE_BUILD aws cli cmd not working?

0

I'm new to AWS CodeBuild and i'm stuck when trying to setup a build project for a container image that is suppose to be pushed to ECR then run on Fargate.

I have used the sample buildspec from this tutorial https://docs.aws.amazon.com/codepipeline/latest/userguide/ecs-cd-pipeline.html

For some reason the build fails during PRE_BUILD and it looks to me that codebuild dosent recognize the AWS cli commands?

Below is the output to Cloudwatch:

[Container] 2022/01/22 20:03:29 Running command echo Logging in to Amazon ECR...
Logging in to Amazon ECR...
[Container] 2022/01/22 20:03:29 Running command aws --version
/codebuild/output/tmp/script.sh: 4: aws: not found
[Container] 2022/01/22 20:03:29 Command did not exit successfully aws --version exit status 127
[Container] 2022/01/22 20:03:29 Phase complete: PRE_BUILD State: FAILED
[Container] 2022/01/22 20:03:29 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: aws --version. Reason: exit status 127

I'm thankful for all the help i can get, thanks in advance!

1개 답변
2
수락된 답변

Solved it myself, if anyone else runs into this beginners mistake , the reason it failed was because i dident use aws linux as build env in the codebuild project. The image i had specified dident have support for aws cli.

답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠