Unable to locate credentials. You can configure credentials by running "aws configure"

151 views Asked by At

How to fix this in PowerSHell script?

I have same trouble in Ubuntu.

# both get-authorization-token cmds result are not visible for aws codeartifact cmd
$env:AWS_SESSION_TOKEN = aws codeartifact get-authorization-token --region eu-west-1 --profile teg --domain teg-live --domain-owner 496716634844 --query authorizationToken --output text

aws configure set aws_session_token $(aws codeartifact get-authorization-token --region eu-west-1 --profile teg --domain teg-live --domain-owner 496716634844 --query authorizationToken --output text)

$domains = aws codeartifact list-domains --query 'domains[].name' --output text

C:\Users\User\.aws\config

[profile PROFILE]
sso_start_url = https://d-xx.awsapps.com/start
sso_region = us-east-1
sso_account_id = xxx
sso_role_name = developers
aws_session_token = eyJ2ZXIiOjEsImlzdSI6MTcwMTI1OT...
[default]
region = eu-west-1
aws_session_token = eyJ2ZXIiOjEsImlzdSI6MTcwM...

Same in C:\Users\User\.aws\config

0

There are 0 answers