2

When I try to use the AWS CLI to run commands for the new AWS CodeCatalyst service, the command hangs for a bit and I keep getting the same error: Unable to locate authorization token

I verified that my AWS profile/credentials are pointing to the AWS account that I linked when I signed up for CodeCatalyst.

% aws --profile dev-admin s3 ls

2020-06-03 06:44:13 bucket1
2022-10-31 16:45:08 bucket2

% aws --profile dev-admin codecatalyst list-access-tokens

Unable to locate authorization token

What am I doing wrong?

dan1st
  • 12,568
  • 8
  • 34
  • 67
JD D
  • 7,398
  • 2
  • 34
  • 53

1 Answers1

4

You can't use your normal AWS credentials when running AWS CLI commands for codecatalyst because CodeCatalyst uses our AWS Builder ID as your user to authenticate and you need a special profile for that.

To get this working, add the following to your ~/.aws/config file to create a profile (calling it codecatalyst in this example):

[profile codecatalyst]
region = us-west-2
sso_session = codecatalyst

[sso-session codecatalyst]
sso_region = us-east-1
sso_start_url = https://view.awsapps.com/start
sso_registration_scopes = codecatalyst:read_write

Then you can run the login command to login and get your credentials setup in the CLI. It will redirect you to a browser window where you need to login with your AWS Builder ID that you used to sign up with CodeCatalyst.

% aws sso login --profile codecatalyst

After this, you can successfully run CodeCatalyst CLI commands using your new profile:

% aws codecatalyst list-access-tokens --profile codecatalyst
{
    "items": [
...
    ]
}

Reference:

JD D
  • 7,398
  • 2
  • 34
  • 53