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.
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 |
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 response.S3.ListObjectsOutput.name ~f:pr ;
let contents =
Option.value ~default:[] response.S3.ListObjectsOutput.contents
in
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))
suite_main
let () =
Command.group ~summary:"Awsm test app" [("test-suite", suite_command)]
|> Command.run
More examples are available in the app directory.
The documentation is available on https://opensource.solvuu.com/docs/awsm/api
To generate the awsm API documentation locally you need odoc
:
opam install odoc
.
Then run make doc
.
Awsm is released under the MIT license.
See CONTRIBUTING for how to help out.