📎 Webclip
Accessing the Amazon AWS from Elixir (using erlcloud)
The post says Amazon does not yet provide an official Elixir SDK for AWS, but erlcloud already makes a lot possible. It presents a quick guide focused on S3 and notes that the library documentation is thin, so the examples are meant to fill that gap.
Reading notes#
- Add
erlcloudtomix.exs, start thesslanderlcloudapplications, then runmix deps.getandmix deps.compile. - Store AWS credentials in environment variables and pass them to
:erlcloud_s3.configure/2from Elixir. - Convert Elixir strings to char lists before passing them to Erlang functions.
- Create an S3 bucket with
:erlcloud_s3.create_bucket/1and use a unique name because bucket names are shared across accounts. - List buckets with
:erlcloud_s3.list_buckets/0and list objects with:erlcloud_s3.list_objects/1. - Store a value with
:erlcloud_s3.put_object/3and read it back with:erlcloud_s3.get_object/2. - Use an Elixir comprehension over
objects[:contents]to get a cleaner list of keys. - The post ends by pointing readers to the
erlcloudsource code for the full set of S3 functions.
