Installing aws-cli
Old method:
image: ubuntu:22.04 options: docker: true pipelines: custom: build: - step: name: Build - apt update && apt upgrade -y - apt -q install -y curl unzip jq - curl https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o /tmp/awscliv2.zip - unzip -q /tmp/awscliv2.zip -d /tmp/ - /tmp/aws/install - CREDJSON="$(aws sts get-session-token --duration-seconds 900 --output json)" - ACCESSKEY="$(echo $CREDJSON | jq '.Credentials.AccessKeyId' | sed 's/"//g')" - SECRETKEY="$(echo $CREDJSON | jq '.Credentials.SecretAccessKey' | sed 's/"//g')" - SESSIONTOKEN="$(echo $CREDJSON | jq '.Credentials.SessionToken' | sed 's/"//g')"
New method: use amazon/aws-cli image in a specific step
image: ubuntu:22.04 options: docker: true pipelines: custom: build: - step: name: Build image: amazon/aws-cli services: - docker script: - yum -y install jq - CREDJSON="$(aws sts get-session-token --duration-seconds 900 --output json)" - ACCESSKEY="$(echo $CREDJSON | jq '.Credentials.AccessKeyId' | sed 's/"//g')" - SECRETKEY="$(echo $CREDJSON | jq '.Credentials.SecretAccessKey' | sed 's/"//g')" - SESSIONTOKEN="$(echo $CREDJSON | jq '.Credentials.SessionToken' | sed 's/"//g')"