Thanks to visit codestin.com
Credit goes to github.com

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

Merged
merged 6 commits into from
Jun 3, 2025

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 22s ⏱️ +10s
     1 suites ±0    1 652 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit a9ec9bb. ± 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 6s ⏱️ -5s
1 suites ±0   2 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit a9ec9bb. ± 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

606 tests  +9   429 ✅ +10   15m 15s ⏱️ +13s
  4 suites ±0   177 💤  -  1 
  4 files   ±0     0 ❌ ± 0 

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

♻️ 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 42m 13s ⏱️ - 1m 9s
4 479 tests +14  4 080 ✅ +4  399 💤 +10  0 ❌ ±0 
4 481 runs  +14  4 080 ✅ +4  401 💤 +10  0 ❌ ±0 

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

This pull request skips 1 and un-skips 1 tests.
tests.aws.services.lambda_.event_source_mapping.test_lambda_integration_sqs.TestSQSEventSourceMapping ‑ test_sqs_event_source_mapping_batch_size_override[10000]
tests.aws.services.dynamodb.test_dynamodb.TestDynamoDB ‑ test_streams_on_global_tables

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented May 21, 2025

Test Results (amd64) - Integration, Bootstrap

    5 files  ± 0      5 suites  ±0   2h 20m 29s ⏱️ -15s
4 834 tests +14  4 283 ✅ +5  551 💤 +9  0 ❌ ±0 
4 840 runs  +14  4 283 ✅ +5  557 💤 +9  0 ❌ ±0 

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

This pull request skips 1 and un-skips 1 tests.
tests.aws.services.lambda_.event_source_mapping.test_lambda_integration_sqs.TestSQSEventSourceMapping ‑ test_sqs_event_source_mapping_batch_size_override[10000]
tests.aws.services.dynamodb.test_dynamodb.TestDynamoDB ‑ test_streams_on_global_tables

♻️ 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
Copy link
Contributor

@simonrw simonrw left a comment

Choose a reason for hiding this comment

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

Thanks for adding this implementation. It has been a problem that crops up every now and again but has never been a high priority. Now we can handle all AWS operations with their strange domain name prefixes!

@joe4dev joe4dev merged commit bc653dc into master Jun 3, 2025
57 checks passed
@joe4dev joe4dev deleted the fix/resolve-custom-host-prefixes-to-localstack branch June 3, 2025 07:08
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