A poetry plugin to help with AWS CodeArtifact authorization automatically
Project description
Poetry AWS Plugin
This is a poetry plugin to help with AWS CodeArtifact authorization by automatically getting the authorization token.
When installing or publishing packages through poetry, the plugin will check whether the command requires CodeArtifact authorization, and if so, adds it automatically.
The plugin will try two methods of authorization, in this order:
- Use AWS credentials to run
sts.AssumeRole, then use that role to runcodeartifact.GetAuthorizationToken. - Use AWS credentials to run
codeartifact.GetAuthorizationToken.
Installation
To install the plugin
poetry self add poetry-aws-plugin
To uninstall the plugin
poetry self remove poetry-aws-plugin
Usage
You must ensure that your AWS credentials are configured and discoverable by boto3. The boto3 documentation has details on how to configure your credentials and the order in which they searched.
When poetry runs a command that uses CodeArtifact, the plugin will automatically check whether the command needs authorization, and if so, requests a CodeArtifact authorization token and adds it to the command.
Your AWS credentials must be authorized to do atleast one of the following:
- Run
codeartifact.GetAuthorizationToken. - Run
sts.AssumeRoleto assume a role with authorization to runcodeartifact.GetAuthorizationToken.
To use IAM roles to authorize, set the environment variable POETRY_AWS_PLUGIN_ROLE_ARN to the role's ARN before running any poetry commands.
For example:
POETRY_AWS_PLUGIN_ROLE_ARN='arn:aws:codeartifact:<region>:<account-id>:repository/<domain>/<domain-owner>/<repository>' poetry install
or
echo "export POETRY_AWS_PLUGIN_ROLE_ARN='arn:aws:codeartifact:<region>:<account-id>:repository/<domain>/<domain-owner>/<repository>'" >> ~/.bashrc
source ~/.bashrc
poetry install
You can find more details in AWS's CodeArtifact authentication and tokens documentation and CodeArtifact IAM documentation.
Misc
You can also authorize by setting the environment variable POETRY_AWS_PLUGIN_AUTH_TOKEN to the CodeArtifact authorization token. This may be useful in CI/CD pipelines and reducing poetry configuration.
For example:
POETRY_AWS_PLUGIN_AUTH_TOKEN='<codeartifact-authorization-token>' poetry install
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
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 poetry_aws_plugin-0.1.12.tar.gz.
File metadata
- Download URL: poetry_aws_plugin-0.1.12.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.10.13 Linux/6.2.0-1019-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19a261f9c38a91c5f9a80f074cbdafb3ef29ff40580d916327c16b4f87e4800f
|
|
| MD5 |
61b33e06fdf9fa8fff75366903843c9e
|
|
| BLAKE2b-256 |
225d4a2b3bbc156b7e4af9ce7caee5a0c05df4612962d90d4b60496f5ef5f347
|
File details
Details for the file poetry_aws_plugin-0.1.12-py3-none-any.whl.
File metadata
- Download URL: poetry_aws_plugin-0.1.12-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.10.13 Linux/6.2.0-1019-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca4e33f5a8c178b8ce5329ae26b054faa0d2c51f3fe0a01d19c0169bef48ffd2
|
|
| MD5 |
9f50d1e4b2f163b317c5dfb47f8cd554
|
|
| BLAKE2b-256 |
52535b60417f1eaea5e8454afff8a1cc57610d80cf92235a4fb590f393a30c4c
|