3

We are building our project and we have to use AWS CLI v2 to deploy our project.

The runtime version that we use is this one:

phases:
  install:
    runtime-versions:
      nodejs: 12.x

Is there an official AWS CodeBuild nodejs image that we can use that has AWS CLI v2 installed or do we need to create our own. Is there an elegant way to upgrade to v2 for the above runtime?

This seems that it works but it might not be very stable in the future:

 # uninstall awscli version 1
 - pip3 uninstall -y awscli
 # install awscli version 2
 - curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
 - unzip awscliv2.zip
 - ./aws/install
2
  • Official images use cli v1. The snipped you showed, does not work? Commented Jul 8, 2020 at 8:28
  • @Marcin it does work, but it might be a bit fragile in the future Commented Jul 8, 2020 at 8:38

1 Answer 1

5

Based on the comments, I can add a little bit of more info.

Official CB docker images are listed here. The two newest ones are

Both these images are also open sourced (links above). Thus, we can inspect their Dockerfile files.

In both of them, awscli is installed in a similar way:

pip3 install --no-cache-dir --upgrade setuptools wheel aws-sam-cli awscli boto3 pipenv virtualenv

As we can see, this installs awscliv1.

Instructions for installing awscliv2 are different and they do not involve pip.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.