Skip to content

Instantly share code, notes, and snippets.

@hankehly
Last active September 15, 2022 00:17
Show Gist options
  • Save hankehly/cc7f6c0fbcfd0e33de843b64b562e056 to your computer and use it in GitHub Desktop.
Save hankehly/cc7f6c0fbcfd0e33de843b64b562e056 to your computer and use it in GitHub Desktop.
Blog Article Snippets - How to share private code without exposing it to the world
# Option 1: login command
aws codeartifact login --tool twine --domain <my_domain> --repository test123
# Option 2: environment variables
export TWINE_USERNAME=aws
export TWINE_PASSWORD=`aws codeartifact get-authorization-token --domain <my_domain> --query authorizationToken --output text`
export TWINE_REPOSITORY_URL=`aws codeartifact get-repository-endpoint --domain <my_domain> --repository test123 --format pypi --query repositoryEndpoint --output text`
# byJ2ZXIiOjEsImlzdSI6MTY2MTY3MD…
export CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain <my_domain> --query authorizationToken --output text`
# https://<my_domain>-<account_id>.d.codeartifact.<region>.amazonaws.com/pypi/test123/
export CODEARTIFACT_REPOSITORY_URL=`aws codeartifact get-repository-endpoint --domain <my_domain> --repository test123 --format pypi - query repositoryEndpoint --output text`
export CODEARTIFACT_USER=aws
poetry config repositories.test123 $CODEARTIFACT_REPOSITORY_URL
poetry config http-basic.test123 $CODEARTIFACT_USER $CODEARTIFACT_AUTH_TOKEN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment