Skip to content

Conversation

@rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Nov 13, 2025

The CLI asks the SDK for the URL to an S3 bucket, in order to pass it to CloudFormation. CloudFormation will then attempt to contact S3 on that URL in order to download the template.

A feature of the the SDK is to respect the $AWS_ENDPOINT_URL_S3 environment variable, which can be used to override the S3 endpoint that the SDK will hit; you might use this if you have private VPC endpoints for a number of AWS services.

The problem arises that $AWS_ENDPOINT_URL_S3 also affects the URL that the CDK CLI passes to CloudFormation. This will most likely be an endpoint that is not routable for CloudFormation like https://vpce-xxx.s3.us-east-1.vpce.amazonaws.com, and CloudFormation will time out waiting for the template download.

To get around this, we will temporarily unset $AWS_ENDPOINT_URL_S3 for the duration of calling the SDK to provide us with a URL.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

…k deploy`

The CLI asks the SDK for the URL to an S3 bucket, in order to pass it to
CloudFormation. CloudFormation will then attempt to contact S3 on that
URL in order to download the template.

A feature of the the SDK is to respect the `$AWS_ENDPOINT_URL_S3`
environment variable, which can be used to override the S3 endpoint
that the SDK will hit; you might use this if you have private VPC
endpoints for a number of AWS services.

The problem arises that `$AWS_ENDPOINT_URL_S3` also affects the URL that
the CDK CLI passes to CloudFormation. This will most likely be an
endpoint that is not routable for CloudFormation like
`https://vpce-xxx.s3.us-east-1.vpce.amazonaws.com`, and CloudFormation
will time out waiting for the template download.

To get around this, we will temporarily unset `$AWS_ENDPOINT_URL_S3`
for the duration of calling the SDK to provide us with a URL.
@rix0rrr rix0rrr requested a review from a team November 13, 2025 12:55
@github-actions github-actions bot added the p2 label Nov 13, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team November 13, 2025 12:56
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.59%. Comparing base (96fda68) to head (4484101).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #933      +/-   ##
==========================================
- Coverage   84.10%   83.59%   -0.51%     
==========================================
  Files          71       71              
  Lines       10437    10437              
  Branches     1336     1323      -13     
==========================================
- Hits         8778     8725      -53     
- Misses       1621     1674      +53     
  Partials       38       38              
Flag Coverage Δ
suite.unit 83.59% <ø> (-0.51%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +110 to +114
* To allow for the off chance that someone is running this tool against a
* custom build of CloudFormation that does need a specific S3 endpoint passed
* to it, we'll introduce a new environment variable that we'll respect instead:
*
* AWS_ENDPOINT_URL_S3_FOR_CLOUDFORMATION
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(blocking): I'm leaning against the proliferation of introducing undocumented env vars doing things. I'm guessing this was added to preempt new issues? Let me reason this through:

  • Currently when AWS_ENDPOINT_URL_S3 is set it will break deployment
  • This PR fixes that
  • If someone deliberately used AWS_ENDPOINT_URL_S3 to do something unknown that we do not know about, they will be broken now.
  • How do they find the new env var? I say they won't and they will open an issue anyway.

I vote we only address this if someone has this problem.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline. This might help use cases like OpenStack and LocalStack.

@aws-cdk-automation aws-cdk-automation added this pull request to the merge queue Nov 14, 2025
Merged via the queue into main with commit 5effc9f Nov 14, 2025
35 checks passed
@aws-cdk-automation aws-cdk-automation deleted the huijbers/override-url branch November 14, 2025 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants