Skip to content

Resolve non-subdomain host prefixes to LocalStack #12653

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

joe4dev
Copy link
Member

@joe4dev joe4dev commented May 21, 2025

Depends: on public DNS entries for the dash-prefixed domains deployed (e.g., data-localhost.localstack.cloud)

Motivation

The botocore specs include 562 operations with prefixed endpoints such as api. or data- and non-subdomains (i.e., - dash-prefixed operations) require special consideration.
These operations are defined in the botocore specs with a hostPrefix. Example for DiscoverInstances in CloudMap: "endpoint":{"hostPrefix":"data-"}

Example of a failing AWS CLI command due to missing DNS resolution:

aws --profile localstack servicediscovery discover-instances --namespace-name my-namespace --service-name my-service

Could not connect to the endpoint URL: "https://data-localhost.localstack.cloud:4566/"

To fix this problem, we need to:
a) deploy public DNS entries for these currently 11 prefixes
b) add them to NAME_PATTERNS_POINTING_TO_LOCALSTACK to ensure they get resolved to LocalStack by our DNS server

Changes

  • Add non-subdomain prefixes to NAME_PATTERNS_POINTING_TO_LOCALSTACK such that these are resolved to LocalStack.
  • Add a unit test to catch potential future additions of host prefixes by comparing the static list to the botocore specs
  • Extend the bootstrap test test_resolve_localstack_host to cover the hostPrefix API operation scenario
  • Add an integration test for a hostPrefix operation for Lambda in test_lambda_host_prefix_api_operation

Discussion

Why a static list?

I think it's clearer (and faster) to maintain a static list such that we have full control and easier visibility into which name patterns get resolved to LocalStack. It also helps detecting changes, which require manual action by deploying a new DNS entry into our public DNS.

@joe4dev joe4dev added this to the 4.5 milestone May 21, 2025
@joe4dev joe4dev self-assigned this May 21, 2025
@joe4dev joe4dev added the semver: patch Non-breaking changes which can be included in patch releases label May 21, 2025
Copy link

github-actions bot commented May 21, 2025

Test Results - Preflight, Unit

21 580 tests  +1   19 928 ✅ +1   6m 9s ⏱️ +2s
     1 suites ±0    1 652 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit e5ee939. ± Comparison against base commit bae7a0e.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented May 21, 2025

Test Results (amd64) - Acceptance

7 tests  ±0   5 ✅ ±0   3m 9s ⏱️ -9s
1 suites ±0   2 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit e5ee939. ± Comparison against base commit bae7a0e.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented May 21, 2025

Test Results - Alternative Providers

597 tests   419 ✅  13m 57s ⏱️
  4 suites  178 💤
  4 files      0 ❌

Results for commit e5ee939.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented May 21, 2025

LocalStack Community integration with Pro

    2 files  ±0      2 suites  ±0   1h 43m 7s ⏱️ +16s
4 466 tests +1  4 076 ✅ ±0  390 💤 +1  0 ❌ ±0 
4 468 runs  +1  4 076 ✅ ±0  392 💤 +1  0 ❌ ±0 

Results for commit e5ee939. ± Comparison against base commit bae7a0e.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented May 21, 2025

Test Results (amd64) - Integration, Bootstrap

    5 files      5 suites   2h 22m 15s ⏱️
4 821 tests 4 279 ✅ 542 💤 0 ❌
4 827 runs  4 279 ✅ 548 💤 0 ❌

Results for commit e5ee939.

♻️ This comment has been updated with latest results.

@joe4dev joe4dev force-pushed the fix/resolve-custom-host-prefixes-to-localstack branch from cb5aed9 to d8751a2 Compare May 23, 2025 12:21
@joe4dev joe4dev force-pushed the fix/resolve-custom-host-prefixes-to-localstack branch from 649d180 to 27cc631 Compare May 26, 2025 17:07
Likely updated related to this change (just a guess): https://github.com/localstack/localstack/pull/12645/files#diff-1d20d60454c412d95e42d6c9d2626a4389b249eb1cc22a8c1a815cf81b1893f5L62

Couldn't find any operations that use the `discovery-` prefix anymore.

```py
discovery_prefixes = df[df['hostPrefix'].str.startswith('discovery-', na=False)]
```
@joe4dev joe4dev marked this pull request as ready for review May 27, 2025 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants