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 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 credentialsawsv2 -V/--version
- Outputawscliv2
andAWS CLI v2
versions
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.2] - 2020-11-23
CI fixes
[1.5.0] - 2020-09-04
Added
awsv2 --install
command to installAWS CLI v2
(Linux and MacOS are supported)awsv2
checks~/.awscliv2/dist/aws
and~/aws-cli/aws
paths before fallback to Docker image
Changed
awsv2 --update
is now an alias forawsv2 --install
awsv2 --version
outputs path to currentAWS CLI v2
executable
Fixed
- Subprocesses always wait for all output to be processed
awsv2 --assume-role
did not use JSON output correctly
[1.4.1] - 2020-09-03
Fixed
awsv2 --assume-role
command now setsaws_session_token
in~/.aws/credentials
awsv2 configure
sometimes did not output tostdout
correctly
[1.4.0] - 2020-09-02
Added
aws_session_token
support toawsv2 --configure
Changed
awsv2 --configure
no longer runs docker, changes file locally instead
[1.3.1] - 2020-09-02
Fixed
- Error if
$HOME/.aws
path does not exist
[1.3.0] - 2020-09-02
Added
awsv2 --assume-role <name> <source_profile> <role_arn>
command
Fixed
- Files in
.aws
folder belonged toroot
user 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
docker
if it was not found
Fixed
- Error while running in non-TTY environment
- Error caused by keyboard interrupt
-U
/--update
command did not return correct exit code
[1.1.0] - 2020-08-29
Added
-U
/--update
CLI argument to pull latestamazon/aws-cli
image
Changed
-V
/--version
command shows underlying image versionregion_name
removed from--configure
command
[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 Distribution
Built Distribution
File details
Details for the file awscliv2-1.5.2.tar.gz
.
File metadata
- Download URL: awscliv2-1.5.2.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e4000a0bdb2dcde387ccda711f054ef25a7c51aa6115ee71159007f08e01d94 |
|
MD5 | 630ce13aa578ffbd74b2f541ed9b8eb7 |
|
BLAKE2b-256 | 94e92f3e0341d14341bf080adfaf5dc4b64d71a2aa03d11563f67dc7d255e827 |
File details
Details for the file awscliv2-1.5.2-py3-none-any.whl
.
File metadata
- Download URL: awscliv2-1.5.2-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.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8550462ac45cbe8ff274b65a381ad8b1c1e02df2930c0200a05c763b0e4e5da |
|
MD5 | a3184b7071484d622cc1e629cfe8bb87 |
|
BLAKE2b-256 | add1770c892d6657c80414c9c0717f677a9fade080217b035acc80cd4c2da881 |