Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bitbucket Pipe for aws-cli v2 with OIDC

James Pinkster May 2, 2023

Hi All

 

Does there exist a somewhat generic Bitbucket Pipe that wraps the AWS CLI v2 command and includes the OIDC authentication options?

 

We've used some of the other pre-baked AWS Pipes such as "atlassian/aws-s3-deploy" which have the OIDC authentication stuff baked in and works quite nicely.

 

However when other AWS CLI commands are needed in automation, we've had to create some custom script to handle the OIDC_TOKEN and call sts assume-role-with-web-identity to get authenticated and then go ahead and run the desired aws cli command.

1 answer

1 accepted

1 vote
Answer accepted
Igor Stoyanov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 5, 2023

@James Pinkster hi. 

Does there exist a somewhat generic Bitbucket Pipe that wraps the AWS CLI v2 command and includes the OIDC authentication options? -- I think the answer is no.

Pipes are the small wrappers, that's allow you to automate some common works, but not the full support like boto3 package for aws cli.

Full list of aws pipes you could find here: Bitbucket AWS pipes .

Also maybe this article will help you.
Here amazon/aws-cli docker image is used.

image: amazon/aws-cli
pipelines:
default:
- step:
oidc: true
script:
- export AWS_REGION=us-west-2
- export AWS_ROLE_ARN=arn:aws:iam::XXXXXXXXXXXX:role/oidc-demo
- export AWS_WEB_IDENTITY_TOKEN_FILE=$(pwd)/web-identity-token
- echo $BITBUCKET_STEP_OIDC_TOKEN > $(pwd)/web-identity-token
- aws s3 cp s3://bucket/XXXXXX ./XXXXXXX

 Regards, Igor

James Pinkster May 8, 2023

The snippet demonstrating the use of the "amazon/aws-cli" image with the AWS_WEB_IDENTITY_TOKEN_FILE environment variable is what I was looking for. I must have missed this when I originally read the docs.

 

Thanks, James

Like Igor Stoyanov likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events