package awsm-codegen

  1. Overview
  2. Docs
AWS botocore code generator


Dune Dependency






Published: 11 Jul 2023


awsm - OCaml AWS client

Pure OCaml client for AWS. Code is auto-generated for all services based on the API declared in botocore. Higher level functions are often implemented on top of this base, e.g. to support multi-part uploads to S3. Sub-libraries are provided for blocking, Async, and Lwt versions of all code.

Table of Contents


Services unix package async package lwt package
Amazon Athena (doc) No Yes No
Amazon Cognito (doc) No Yes No
Amazon EC2 (doc) No Yes No
Amazon ECR (doc) No Yes No
Amazon Glue (doc) No Yes No
Amazon IAM (doc) No Yes No
Amazon S3 (doc) No Yes No
Amazon SQS (doc) No Yes No
Cognito SRP No Yes No
Amazon STS (doc) No Yes No

Getting started

Install and build with local OPAM switch and lock file

Run the following commands to install a local OPAM switch based on OCaml 4.11.2 and install all package dependencies via OPAM. (Note that after running make we must also configure the local OPAM environment.)

make install-deps
eval $(opam env)

To actually build the project you are advised to lift system restrictions on stack size, because otherwise some files will fail to build due to stack overflows. On a modern Linux system you can wrap the invocation of make under prlimit:

prlimit --stack=unlimited make


Here is a short example where we use the S3 API to list the objects of the provided bucket (see amazon API).

open Awsm_async
open! Import
open IO
module S3 = Awsm_s3.Make (IO) (Http)

let pr = Caml.print_endline

let suite_main bucket () =
  Cfg.get () >>= fun cfg ->
  S3.listBuckets cfg >>= fun _ ->
  S3.listObjects cfg (S3.ListObjectsRequest.make ~bucket ()) >>= function
  | #S3.listObjects_error -> failwith "list objects error"
  | `Ok response ->
     Option.iter ~f:pr ;
     let contents =
       Option.value ~default:[] response.S3.ListObjectsOutput.contents
     let on_object oo = Option.iter (oo.S3.Object.key :> string option) ~f:pr in
     List.iter contents ~f:on_object ;
     return ()

let suite_command =
  Command.async_spec ~summary:"Test script"
    Command.Spec.(empty +> anon ("bucket" %: string))

let () = ~summary:"Awsm test app" [("test-suite", suite_command)]

More examples are available in the app directory.


The documentation is available on

To generate the awsm API documentation locally you need odoc: opam install odoc.

Then run make doc.


Awsm is released under the ISC license.

How to contribute

See CONTRIBUTING for how to help out.

Dependencies (12)

  1. yojson >= "1.6.0"
  2. xmlm
  3. sedlex >= "2.3"
  4. re >= "1.7.2"
  5. ppxlib >= "0.27"
  6. ocamlgraph
  7. ocamlformat
  8. core_unix
  9. core < "v0.16.0"
  10. uri-sexp
  11. cohttp
  12. dune >= "3.6"

Dev Dependencies (1)

  1. odoc with-doc

Used by (1)

  1. awsm




Innovation. Community. Security.