Module Awskit_lwt_unix

Lwt + Unix runtime adapter for AWS.

Ready-to-use adapter for Lwt applications on Unix. Uses Cohttp_lwt_unix.Client for HTTP — just create a connection and start making AWS calls:

  let conn =
    Awskit_lwt_unix.create ~region:"us-east-1" ~credentials ()
    |> Result.get_ok
  in
  (* pass [conn] to any service package, e.g. Awskit_s3_lwt_unix *)

For MirageOS or custom Lwt HTTP backends, use the generic Awskit_lwt.Make functor instead.

type t

Connection handle. Create with create, then pass to service operations.

module Runtime : Awskit.Runtime.S with type 'a t = 'a Lwt.t and type connection = t

Runtime module satisfying Awskit.Runtime.S. The monad is Lwt.t.

module Credentials : sig ... end
val create : ?ctx:Cohttp_lwt_unix.Client.ctx -> ?endpoint:string -> ?region:string -> ?credentials:Awskit.Credentials.t -> ?clock:(unit -> Ptime.t) -> ?retry_policy:Awskit.Retry.t -> ?random_float:(upper_bound:float -> float) -> ?timeout_policy:Awskit.Timeout.policy -> ?max_response_drain_bytes:int -> ?imdsv1_fallback:Credentials.imdsv1_fallback -> unit -> (t, Awskit.Error.t) Stdlib.result

Create a connection to AWS.

  • parameter ctx

    Optional Cohttp client context (e.g., for custom TLS config)

  • parameter endpoint

    Explicit endpoint override for local test services or custom service endpoints. Parsed as http:// or https:// endpoint URL.

  • parameter region

    AWS region (e.g., "us-east-1"). If omitted, reads AWS_REGION and then AWS_DEFAULT_REGION.

  • parameter credentials

    AWS credentials for request signing. If omitted, resolves the awskit-unix default credential chain: static AWS environment variables, shared AWS profile files, ECS/container credentials, then EC2 instance profile credentials.

  • parameter clock

    Time source for signing timestamps (default: OS clock)

  • parameter retry_policy

    Retry behavior for retryable AWS errors and transient transport failures (default: Awskit.Retry.default)

  • parameter random_float

    Random delay source for retry jitter. Defaults to a connection-local random state.

  • parameter timeout_policy

    Runtime timeout policy (default: Awskit.Timeout.default).

  • parameter max_response_drain_bytes

    Maximum response body bytes to drain after callbacks (default: 64 MiB). If a response consumer succeeds but the remaining body exceeds this drain limit, the operation fails with a body-limit error. If the consumer fails, the consumer error is returned. Response body read timeouts invalidate the reader; native Lwt.Canceled from user callbacks and body reads is preserved.

  • parameter imdsv1_fallback

    Controls tokenless IMDSv1 fallback when the default credential chain uses EC2 instance metadata credentials.