aws/config

Customer-facing construction settings — the service-agnostic knobs every Client is built from. AWS endpoint-rule-set parameters (UseFIPS, UseDualStack, S3 ForcePathStyle, …) are NOT here: they vary per service and live on each service’s own typed EndpointParams record, kept separate so customer config and AWS rule-set attributes never mix.

Two construction entry points per service:

  1. <service>.new() — full auto: region resolves from the standard AWS sources, credentials from the default chain. Zero config.

  2. <service>.new_with(settings, endpoint_params) — start each record from its defaults and override only the fields you need:

    import aws/config.{Settings, default_settings} import aws/services/s3

    let assert Ok(client) = s3.new_with( Settings(..default_settings(), region: Some(“eu-west-1”)), s3.EndpointParams(..s3.default_endpoint_params(), use_fips: Some(True)), )

Types

Declarative, service-agnostic settings for building a Client. Start from default_settings() and override the fields you care about with a record-update spread — see the module docs. AWS endpoint-rule-set parameters are not here; they live on each service’s EndpointParams.

pub type Settings {
  Settings(
    region: option.Option(String),
    profile: String,
    credentials: option.Option(credentials.Provider),
    endpoint_url: option.Option(String),
    max_attempts: option.Option(Int),
    retry_strategy: option.Option(retry.Strategy),
    http_send: option.Option(
      fn(request.Request(BitArray)) -> Result(
        response.Response(BitArray),
        http_send.HttpError,
      ),
    ),
    streaming_http_send: option.Option(
      fn(request.Request(BitArray)) -> Result(
        response.Response(streaming.StreamingBody),
        http_send.HttpError,
      ),
    ),
    use_http2: Bool,
    sigv4a_region_set: option.Option(List(String)),
    sigv4a_normalize_path: Bool,
  )
}

Constructors

  • Settings(
      region: option.Option(String),
      profile: String,
      credentials: option.Option(credentials.Provider),
      endpoint_url: option.Option(String),
      max_attempts: option.Option(Int),
      retry_strategy: option.Option(retry.Strategy),
      http_send: option.Option(
        fn(request.Request(BitArray)) -> Result(
          response.Response(BitArray),
          http_send.HttpError,
        ),
      ),
      streaming_http_send: option.Option(
        fn(request.Request(BitArray)) -> Result(
          response.Response(streaming.StreamingBody),
          http_send.HttpError,
        ),
      ),
      use_http2: Bool,
      sigv4a_region_set: option.Option(List(String)),
      sigv4a_normalize_path: Bool,
    )

    Arguments

    region

    AWS region. None (the default) resolves it at build time from AWS_REGION, AWS_DEFAULT_REGION, then ~/.aws/config under profile. Some(r) pins it explicitly.

    profile

    Profile name used for both region and credential resolution.

    credentials

    Credentials provider. None (the default) uses the standard chain (env → web-identity → SSO → profile → process → ECS → IMDS).

    endpoint_url

    Endpoint URL override (LocalStack, FIPS, custom DNS). None lets the service’s Smithy endpoint rule set compute the URL.

    max_attempts

    Retry attempt budget. Some(1) disables retries (one attempt per request); None keeps the standard 3-attempt strategy (or retry_strategy, when that is set).

    retry_strategy

    Full retry-strategy override. None keeps retry.standard(). When max_attempts is also set, the attempt budget is applied on top of this strategy.

    http_send

    Buffered HTTP transport override (test doubles, proxies). None uses the default httpc sender.

    streaming_http_send

    Streaming HTTP transport override for @streaming operations. None uses the default chunked sender.

    use_http2

    Use the HTTP/2 streaming transport. Buffered requests are unaffected; peers that don’t speak HTTP/2 negotiate down via ALPN.

    sigv4a_region_set

    Opt into SigV4a (asymmetric ECDSA P-256) signing: Some(region_set) becomes the X-Amz-Region-Set header — required for S3 Multi-Region Access Points. None uses SigV4.

    sigv4a_normalize_path

    RFC-3986 dot-segment removal under SigV4a. Leave True for most services; S3 needs False so object keys with . / .. survive the canonical-request step. No effect unless sigv4a_region_set is Some.

Values

pub fn default_settings() -> Settings

The full-auto baseline: region + credentials resolve themselves and every other knob keeps the runtime default. Spread this with a record update and override only the fields you need.

pub fn resolve(
  settings: Settings,
  endpoint_prefix endpoint_prefix: String,
  signing_name signing_name: String,
) -> Result(runtime.ClientConfig, region.ResolveError)

Resolve Settings into a runtime ClientConfig for a service, identified by its endpoint prefix + SigV4 signing name. The only failure is region resolution when region is None and no source supplies one; credentials stay lazy (the per-Client cache fetches them on the first request), so a missing chain surfaces at call time, not here.

Generated new / new_with call this, then apply the service’s typed EndpointParams, attach its endpoint rule set, and start the credentials cache.

Search Document