Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions localstack-core/localstack/aws/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import json
import logging
import re
import threading
from abc import ABC, abstractmethod
from collections.abc import Callable
Expand Down Expand Up @@ -515,9 +514,6 @@ def get_client(
config = self._config.merge(config)

endpoint_url = endpoint_url or get_service_endpoint()
if service_name == "s3" and endpoint_url:
if re.match(r"https?://localhost(:[0-9]+)?", endpoint_url):
endpoint_url = endpoint_url.replace("://localhost", f"://{get_s3_hostname()}")

return self._get_client(
service_name=service_name,
Expand Down Expand Up @@ -578,10 +574,10 @@ def get_client(
if region_name == AWS_REGION_US_EAST_1:
config = config.merge(Config(region_name=region_name))

endpoint_url = endpoint_url or get_service_endpoint()
if service_name == "s3":
if re.match(r"https?://localhost(:[0-9]+)?", endpoint_url):
endpoint_url = endpoint_url.replace("://localhost", f"://{get_s3_hostname()}")
if not endpoint_url:
endpoint_url = get_service_endpoint()
if service_name == "s3":
endpoint_url = f"{localstack_config.get_protocol()}://{get_s3_hostname()}:{localstack_config.GATEWAY_LISTEN[0].port}"

# Prevent `PartialCredentialsError` when only access key ID is provided
# The value of secret access key is insignificant and can be set to anything
Expand Down
Loading