Skip to main content

Authorization token

We use AWS CodeArtifact service to maintain private PyPI and npm artifact repository. To install packages from this repository, an authorization token is used.

How to generate authorization token?

To generate authentication token, you can use AWS CodeArtifact get-authorization-token API and use it with the package installer along with the default username aws.

aws codeartifact get-authorization-token --domain neev --domain-owner 529730085565 --query authorizationToken --output text --region eu-west-2

You can store the credential into an environment variable so that you can use it in other commands or scripts.

export CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain neev --domain-owner 529730085565 --query authorizationToken --output text --region eu-west-2`

More details on getting the authorization token.

tip

If you get "An error occurred (ResourceNotFoundException) when calling the GetAuthorizationToken operation: Domain not found. Domain 'neev' owned by account '529730085565' does not exist."
Then make sure the aws cli has been set with an account in the o-akodnm2nsf org id. (ECS org).

caution

The token is valid for 12 hours by default. You'll need to call this command again to get a new token.

note

Valid AWS credentials must be available in credential provider chain for the CLI to use.

E.g. Set AWS_PROFILE environment variable to use a named profile.

MacOS or Linux
export AWS_PROFILE=<profile-name>
Powershell
$env:AWS_PROFILE = "<profile-name>"