In CodeBuild how to resolve error Could not connect to the endpoint URL: "https://sts.amazonaws.com/"

0

Hi,

In my Codebuild that that is triggered after I submit my changes through the PR(Pull Request), as per the commands listed in the buildspec.yml , it runs one of the command(mentioned below) in the Code Build run.

Command in CodeBuild : OUT=$(aws sts assume-role --role-arn ${ROLE} --role-session-name carbon-${env}-sts) **

This codebuild run on AWS fails with error msg - "Could not connect to the endpoint URL: "https://sts.amazonaws.com/"

So i hard coded the region with the same command as mentioned above and it still fails with the same error.

Modified Command(hard coding the region) : OUT=$(aws sts assume-role --region="<our specific region name>" --role-arn ${ROLE} --role-session-name carbon-${env}-sts)

Result : It still fails with the same error as above i.e. unable to connect the endpoint , URL="https://sts.amazonaws.com"/

Any assistance to resolve the error will be greatly appreciated.

asked a year ago1307 views
2 Answers
0

Hi. Didn't you create codebuild in VPC? If so, NATGateway or nat instance is needed. https://docs.aws.amazon.com/codebuild/latest/userguide/vpc-support.html

profile picture
EXPERT
answered a year ago
profile picture
EXPERT
reviewed a year ago
0

Another option is installing a VPC Endpoint for STS in your VPC.

profile pictureAWS
EXPERT
kentrad
answered a year ago
profile picture
EXPERT
reviewed a year 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