Skip to content
cloud

GitHub Action

AWS CLI v2

v1.0.19 Latest version

AWS CLI v2

cloud

AWS CLI v2

A simple GitHub action using official AWS Image which allows running all commands that starts with "aws ...".

Installation

Copy and paste the following snippet into your .yml file.

              

- name: AWS CLI v2

uses: imehedi/actions-awscli-v2@v1.0.19

Learn more about this action in imehedi/actions-awscli-v2

Choose a version

GitHub Actions release flow

Action - AWS CLI V2

This action provides capability to run any of the AWS CLI commands using version 2 of the CLI tool.

- name: AWS CLI v2
  uses: imehedi/actions-awscli-v2@latest
  with:
    args: s3 ls

We are using the base image from AWS and simply providing a dockerised interface to the tool, we can perform activities within our repo as if we were using the tool locally.

aws s3 ls

The above then requires us to pass the credentials from GitHub secrets, which we can do as below:

- name: AWS CLI v2
  uses: imehedi/actions-awscli-v2@latest
  with:
      args: s3 ls
  env:
      AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
      AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
      AWS_DEFAULT_REGION: "eu-west-1"

###Materials for curious minds