Skip to main content

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 and running into a CodeArtifact-related authorization error, the plugin will automatically get the authorization token and retry the command.

The plugin will try two methods of authorization, in this order:

  1. Use AWS credentials to run codeartifact.GetAuthorizationToken.
  2. Use AWS credentials to run sts.AssumeRole, then use that role 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 and fails to authorize, the plugin will automatically attempt to get the authorization token and retry the command.

Your AWS credentials must be authorized to do atleast one of the following:

  1. Run codeartifact.GetAuthorizationToken.
  2. Run sts.AssumeRole to assume a role with authorization to run codeartifact.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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

poetry_aws_plugin-0.1.8.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

poetry_aws_plugin-0.1.8-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file poetry_aws_plugin-0.1.8.tar.gz.

File metadata

  • Download URL: poetry_aws_plugin-0.1.8.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

Hashes for poetry_aws_plugin-0.1.8.tar.gz
Algorithm Hash digest
SHA256 0fdb7c2b8b8378cdbac7432930949e1e1a16661dbb22e632b1683dd685ae707c
MD5 c650dca789893a543a047e88367c7257
BLAKE2b-256 835718c2bc9e9f5e0b08c29571de408a649776a37f404bd88bfe7ce61e6b539a

See more details on using hashes here.

File details

Details for the file poetry_aws_plugin-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: poetry_aws_plugin-0.1.8-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

Hashes for poetry_aws_plugin-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 32d69578d71e6b9bc7d7f0e21224c07cc070a3ec14f53c7465fe4b9e8c2fd202
MD5 2f93b877a8b548a4d819fe84e027de40
BLAKE2b-256 dc3881dd904fc4b1e0850a2242fc0049a2c4b3b29a98aecb89cf30ba864a1305

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page