The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

OIDC and boto3: InvalidIdentityToken

Georg Duemlein
March 26, 2023

I have an OIDC provider configured in my AWS account.

It works nicely for the pipelines so far.

 

I am now trying to run a python boto3 script in the pipeline and I get this error:

botocore.errorfactory.InvalidIdentityTokenException: An error occurred (InvalidIdentityToken) when calling the AssumeRoleWithWebIdentity operation: No OpenIDConnect provider found in your account for

The IdentityProvider mentioned in the message exists.
I even created a second one with trailing slashes - I read that might be the issue.

 

Are the any extra steps I need to take to have boto3 scripts run in the pipeline with OIDC?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Georg Duemlein
March 27, 2023

Looks like the documented snippet is not working for this use case.

Instead of this:

- export AWS_ROLE_ARN=arn:aws:iam::<redacted>:role/<redacted>
- export AWS_WEB_IDENTITY_TOKEN_FILE=$(pwd)/web-identity-token
- echo $BITBUCKET_STEP_OIDC_TOKEN > $(pwd)/web-identity-token

I need to use something like this:

- export AWS_ROLE_ARN=arn:aws:iam::<redacted>:role/<redacted>
- export AWS_WEB_IDENTITY_TOKEN_FILE=~/.aws/web-identity-token
- mkdir -p ~/.aws
- echo "${BITBUCKET_STEP_OIDC_TOKEN}" >> ${AWS_WEB_IDENTITY_TOKEN_FILE}
- chmod 400 ${AWS_WEB_IDENTITY_TOKEN_FILE}

I assume that boto3 is a bit more strict when it comes to finding the files - compared to terraform - which doesn't seem to have an issue with the documented bitbucket way.

DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events