Skip to main content

AWS CLI v2 for Python

PyPI - awscliv2 PyPI - Python Version

Wrapper for AWS CLI v2. Comes with zero dependencies, updates awscli, gives access to all services!

Before you start

  • This is not an official AWS CLI v2 application, rant there
  • Check the source code of this app, as you are working with sensitive data
  • By default this app uses amazon/aws-cli Docker image
  • To use binaries for your OS, run awsv2 --install
  • Cross-check the source code again, probably I want to steal your credentials

Installation

python -m pip install awscliv2

You can add an alias to your ~/.bashrc or ~/.zshrc to use it as a regular AWS CLI v2

alias aws='awsv2'

Usage

Install AWS CLI v2:

# do not worry if this fails, you can still use awsv2 if you have docker installed
awsv2 --install

Configure default profile if needed:

AWS_ACCESS_KEY_ID='my-access-key'
AWS_SECRET_ACCESS_KEY='my-secret-key'

# --configure <profile_name> <aws_access_key_id> <aws_secret_access_key> [<aws_session_token>]
awsv2 --configure default ${AWS_ACCESS_KEY_ID} ${AWS_SECRET_ACCESS_KEY}
awsv2 configure set region us-west-1

Use AWS CLI as usual:

# alias for
# docker run --rm -i -v ~/.aws:/root/.aws -v $(pwd):/aws amazon/aws-cli $@
awsv2 s3 ls

# or as a python module
python -m awscliv2 s3 ls

Also, you can check scripts/example.sh

Docker fallback

Unless you run awsv2 --install once, application will use amazon/aws-cli Docker image. The image is not ideal, and it uses root user, so fix downloaded file permissions manually. Or just run awsv2 --install

Update it with docker pull amazon/aws-cli.

Container uses two volumes:

  • $HOME/.aws -> /root/.aws - credentials and config store
  • $(cwd) -> /aws - Docker image workdir

Extra commands

awscliv2 contains a few commands to make your life easier, especially in CI or any non-TTY environment.

  • awsv2 -U/--update/--install - Install AWS CLI v2
  • awsv2 --configure <profile_name> <aws_access_key_id> <aws_secret_access_key> [<aws_session_token>] - set profile in ~/.aws/credentials
  • awsv2 --assume-role <profile_name> <source_profile> <role_arn> - create a new profile with assume role credentials
  • awsv2 -V/--version - Output awscliv2 and AWS CLI v2 versions

Development

  • Install poetry
  • Run poetry install
  • Use black formatter in your IDE

How to help

  • Ping AWS team to release an official PyPI package
  • Help me to test MacOS installer and add Windows installer
  • Share your experience in issues

Versioning

awscliv2 version follows PEP 440.

Latest changes

Full changelog can be found in Changelog. Release notes can be found in Releases.

Metadata

Release files for awscliv2 2.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for awscliv2 2.0.2
File Size Uploaded Provenance Actions
awscliv2-2.0.2.tar.gz 10.8 kB Without provenance Details for awscliv2-2.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for awscliv2 2.0.2
File Interpreter ABI Platform Actions
awscliv2-2.0.2-py3-none-any.whl Python 3 none any Details for awscliv2-2.0.2-py3-none-any.whl

Total release size: 22.9 kB

Release files / awscliv2-2.0.2.tar.gz

Download URL awscliv2-2.0.2.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
57a532129fa90b288be17a7102008fd3083bab9d35565a7a63f7c3d3f1e70ea7
BLAKE2b-256 checksum
How to use checksums
8bc50a168332d5cb151d4c587cac2d91767e63c76431a5d5fa5abfe6e3c8beda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.2.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

Release files / awscliv2-2.0.2-py3-none-any.whl

Download URL awscliv2-2.0.2-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
212ec3d57cb3dc81929d3148bc6f8169998a83fb703fdd3952ee2a99f1910e4c
BLAKE2b-256 checksum
How to use checksums
226b293d36270327a29c7e8ded077a26412873037a88697905eddec75590f7b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.2.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

Security for awscliv2 2.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page