Skip to content

Force S3 path style for lstk cdk on CDK 2.1138.0+ - #497

Merged
peter-smith-phd merged 1 commit into
mainfrom
dpx-723-cdk-force-path-style
Sep 9, 2026
Merged

Force S3 path style for lstk cdk on CDK 2.1138.0+#497
peter-smith-phd merged 1 commit into
mainfrom
dpx-723-cdk-force-path-style

Conversation

@peter-smith-phd

@peter-smith-phd peter-smith-phd commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Motivation

Now that CDK (version 2.1138.0 and higher) supports the CDK_S3_FORCE_PATH_STYLE flag, we can now do better at enabling S3 path-style access whenever necessary, such as for LocalStack endpoints that don't naturally support virtual host names, such as http://localhost:4566. In fact, our own ephemeral instances don't support <bucket>.s3. as a prefix on the DNS name, so virtual-host-style access had previously resulted in an error.

Solution

For CDK 2.1138.0 and higher, set CDK_S3_FORCE_PATH_STYLE=1 for the cdk subprocess and pass the S3 endpoint through unprefixed (that is, without the s3. prefix). For older CDK versions, there's no impact, and the s3. prefix is still required in order to trigger virtual-host-style resolution.

Testing

Validated with:

  • http://localhost:4566
  • http://127.0.0.1:4566
  • http://127-0-0-1.sslip.io:4566 - resolves to 127.0.0.1, but not a pattern that lstk previously looked for.
  • https://ls-xxxxxx.sandbox.localstack.cloud

Closes DPX-723

Co-Authored-By: Claude <noreply@anthropic.com>
@peter-smith-phd peter-smith-phd added semver: patch docs: needed Pull request requires documentation updates docs: skip Pull request does not require documentation changes and removed docs: needed Pull request requires documentation updates labels Sep 8, 2026
@peter-smith-phd
peter-smith-phd marked this pull request as ready for review September 9, 2026 02:05
@peter-smith-phd
peter-smith-phd requested a review from a team as a code owner September 9, 2026 02:05
@peter-smith-phd
peter-smith-phd merged commit 469b487 into main Sep 9, 2026
27 checks passed
@peter-smith-phd
peter-smith-phd deleted the dpx-723-cdk-force-path-style branch September 9, 2026 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs: skip Pull request does not require documentation changes semver: patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant