28

Recently the following GitHub Action has been deprecated with a deletion date already established at end of month (2019-12-31). The issue is, there is no "official" alternative yet (should be here). My questions are:

  1. Does someone know if the "official" action will be released before 2019-12-31?

  2. Is there an alternative?

5 Answers 5

42

aws-cli package is available in GitHub-hosted virtual environments. (aws-cli/1.16.266 Python/2.7.12 Linux/4.15.0-1057-azure botocore/1.13.2)

Make sure to set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY in environment variables. You can use Github secrets to store these credentials securely.

- name: Upload to S3
  run: |
    aws s3 sync ./build s3://test-bucket
  env:
    AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
    AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
    AWS_DEFAULT_REGION: 'ap-south-1'
2
  • 2
    Thanks, that is exactly the case. If you want it is possible to setup credentials using github.com/aws-actions/configure-aws-credentials which is nice if you have to perform more then one step with the aws-cli or have a fancy login schema.
    – Pedro
    Commented Dec 6, 2019 at 20:32
  • You don't really need a special step to set up credentials just make sure you name your GitHub repository secrets AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
    – Glenn Bech
    Commented Sep 27, 2021 at 19:18
11

From GitHub documentation the aws-cli is already available directly on the host image.

It would be nice if this information were available on the deprecation notice ¯\_(ツ)_/¯

1
  • It's not on XL machines yet though Commented Nov 15, 2023 at 13:08
8

The AWS CLI will come preinstalled on GitHub Actions environments. More information can be found in the actions/virtual-environments repository. In my case I needed the latest possible version of the CLI. I followed the AWS CLI Install documentation and added the following step to a workflow running on ubuntu/latest:

-   name: Install AWS CLI v2
    run:  |
          curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o /tmp/awscliv2.zip
          unzip -q /tmp/awscliv2.zip -d /tmp
          rm /tmp/awscliv2.zip
          sudo /tmp/aws/install --update
          rm -rf /tmp/aws/
3

An alternative to default awscli, or using third party actions is to configure python and install the awscli at the time of the build:

name: Sync to S3 bucket
on: [push]
jobs:
  sync:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
        with:
          python-version: '3.7'
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install awscli
      - run: aws s3 sync builddir s3://foobar --region eu-west-1 --cache-control max-age=0 --acl public-read --delete
        env:
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

"Github Actions > Building and testing Python" docs on Github https://docs.github.com/en/actions/guides/building-and-testing-python

1
  • FYI, the pip package installs the v1 AWS CLI. From the pypi page: "This README is for the AWS CLI version 1. If you are looking for information about the AWS CLI version 2, please visit the v2 branch." pypi.org/project/awscli
    – JHS
    Commented Mar 27 at 19:12
0

The repo was updated yesterday with the following new deprecation notice:

This action has been deprecated in favor of https://github.com/aws-actions. This repo has been archived and will be made private on 12/31/2019

1
  • 1
    The new aws-actions does not include de CLI, hence my initial question and followup answer.
    – Pedro
    Commented Dec 4, 2019 at 9:47

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.