CodeArtifact setting error - sts:GetServiceBearerToken

0

I'm trying to set CodeArtifact so that I created domain and repository by manual. But whenever I put command line to access repo it give me back error message like below. Would you help me? I already add a "AWSCodeArtifactAdminAccess" permission on IAM Identity Center

Command line : aws codeartifact login --tool npm --repository npm-store --domain domain-npm --domain-owner 111111111 --region us-east-1

Error msg : when calling the GetAuthorizationToken operation: User: arn:aws:iam::111111111:root is not authorized to perform: sts:GetServiceBearerToken on resource: arn:aws:iam::111111111:root

Hi Im trying to set CodeArtifact so that I created domain and repository by manual. But whenever I put command line to access repo it give me back error message like below. Would you help me? I already add a "AWSCodeArtifactAdminAccess" permission on IAM Identity Center

Command line : aws codeartifact login --tool npm --repository npm-store --domain domain-npm --domain-owner 111111111 --region us-east-1

Error msg : when calling the GetAuthorizationToken operation: User: arn:aws:iam::111111111:root is not authorized to perform: sts:GetServiceBearerToken on resource: arn:aws:iam::111111111:root

haha
asked 10 months ago699 views
2 Answers
0
Accepted Answer

I solved it. I was trying to get access to codeartifact repo from EC2 without login(aws configure). I assigned a Access keys to a user account and then tried it again after login, it worked.

haha
answered 10 months ago
0

The permission below is also given to a user on IAM Identity Center

{ "Version": "2012-10-17", "Statement": [ { "Action": [ "codeartifact:" ], "Effect": "Allow", "Resource": "" }, { "Effect": "Allow", "Action": "sts:GetServiceBearerToken", "Resource": "*", "Condition": { "StringEquals": { "sts:AWSServiceName": "codeartifact.amazonaws.com" } } } ] }

haha
answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions