Wrapper for AWS CLI v2
Project description
AWS CLI v2 for Python
Wrapper for AWS CLI v2.
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 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- InstallAWS CLI v2awsv2 --configure <profile_name> <aws_access_key_id> <aws_secret_access_key> [<aws_session_token>]- set profile in~/.aws/credentialsawsv2 --assume-role <profile_name> <source_profile> <role_arn>- create a new profile with assume role credentialsawsv2 -V/--version- Outputawscliv2andAWS CLI v2versions
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.
Change Log
All notable changes to this project are documented on Releases page.
The format is based on Keep a Changelog and this project adheres to PEP 440.
[Released]
[1.5.0] - 2020-09-04
Added
awsv2 --installcommand to installAWS CLI v2(Linux and MacOS are supported)awsv2checks~/.awscliv2/dist/awsand~/aws-cli/awspaths before fallback to Docker image
Changed
awsv2 --updateis now an alias forawsv2 --installawsv2 --versionoutputs path to currentAWS CLI v2executable
Fixed
- Subprocesses always wait for all output to be processed
awsv2 --assume-roledid not use JSON output correctly
[1.4.1] - 2020-09-03
Fixed
awsv2 --assume-rolecommand now setsaws_session_tokenin~/.aws/credentialsawsv2 configuresometimes did not output tostdoutcorrectly
[1.4.0] - 2020-09-02
Added
aws_session_tokensupport toawsv2 --configure
Changed
awsv2 --configureno longer runs docker, changes file locally instead
[1.3.1] - 2020-09-02
Fixed
- Error if
$HOME/.awspath does not exist
[1.3.0] - 2020-09-02
Added
awsv2 --assume-role <name> <source_profile> <role_arn>command
Fixed
- Files in
.awsfolder belonged torootuser if they were created byawsv2
[1.2.0] - 2020-08-30
Added
- Support for interactive commands like
awsv2 configure
Changed
- Instructions output how to install
dockerif it was not found
Fixed
- Error while running in non-TTY environment
- Error caused by keyboard interrupt
-U/--updatecommand did not return correct exit code
[1.1.0] - 2020-08-29
Added
-U/--updateCLI argument to pull latestamazon/aws-cliimage
Changed
-V/--versioncommand shows underlying image versionregion_nameremoved from--configurecommand
[1.0.0] - 2020-08-29
Initial release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file awscliv2-1.5.0-py3-none-any.whl.
File metadata
- Download URL: awscliv2-1.5.0-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe2307c76e282b716b02072ac2e0915f32625ac2bd354d4640dabda1559a73cd
|
|
| MD5 |
95cd491e43dfd9e5460c7c275a9a5297
|
|
| BLAKE2b-256 |
9b477407dc296b943ad553f09e8844cab93398067b0c5507a2afeddf9c58a76c
|