Skip to main content
This guide uses AWS SDK for Go v2 and S3. The application keeps using AWS request and response types; only the client endpoint changes.

Choose how to set the endpoint

Set it for the process

AWS SDK for Go v2 reads that service-specific setting during LoadDefaultConfig. Build the S3 client without assigning BaseEndpoint:

Set it on one client

Keep the endpoint in a client factory. Do not install a process-wide resolver that redirects unrelated AWS services unless every redirected service has a configured adapter. BaseEndpoint on the client takes precedence over AWS_ENDPOINT_URL_S3.

Verify an object lifecycle

In production, do not read unbounded object bodies into memory.

Classify failures before retrying

Use errors.As to distinguish a service response from a transport or context failure. Capture the Smithy operation error, service error code, HTTP status, and request ID when present. A context deadline after PutObject is an uncertain write; inspect target state before retrying.

Production checklist

  • Pin the Go v2 module versions you test.
  • Give every request an appropriate deadline.
  • Reuse clients and HTTP transports.
  • Test paginator termination and continuation tokens.
  • Verify path-style or virtual-host addressing for the deployed endpoint.
  • Compare native target state after writes.
  • Exercise one expected not-found response.
See the S3 service page, response headers, and testing guide.