Git Product home page Git Product logo

aws-erlang's Introduction

AWS clients for Erlang

Actions Status

:rocket: Create, configure, and manage AWS services from Erlang code. :rocket:

Features

  • A clean API separated per service. One module per service.
  • Support for most of the AWS services.
  • Generated by aws-codegen using the same JSON descriptions of AWS services used to build the AWS SDK for Go.
  • Documentation updated from the official AWS docs.

Usage

Here is an example of listing Amazon Kinesis streams. First of all, start a shell with rebar3 shell, then:

> Client = aws_client:make_client(<<"my-access-key-id">>, <<"my-secret-access-key">>, <<"eu-west-1">>),
[...]
> {ok, Result, _Response} = aws_kinesis:list_streams(Client, #{}),
[...]
> io:format("~p~n", [Result]).
#{<<"HasMoreStreams">> => false,<<"StreamNames">> => []}

Here is another example, this time using a temporary client, showing how to upload a file to S3 and how to fetch it back:

> Client = aws_client:make_temporary_client(<<"my-access-key-id">>, <<"my-secret-access-key">>, <<"my-token">>, <<"eu-west-1">>).
[...]
> {ok, Content} = file:read_file("/tmp/erlang-logo.png").
[...]
> aws_s3:put_object(Client, <<"my-bucket">>, <<"my-key">>, #{<<"Body">> => Content}).
[...]
> {ok, Response, _} = aws_s3:get_object(Client, <<"my-bucket">>, <<"my-key">>).
[...]
> Content = maps:get(<<"Body">>, Response).

Installation

Simply add the library to your rebar.config:

{deps, [{aws, "0.3.0", {pkg, aws_erlang}}]}.

Obtaining Credentials

Credentials can be obtained via the separate aws_credentials application, which can be configured to fetch credentials from:

  • Erlang environment variables
  • OS environment variables
  • An AWS credentials file
  • ECS task credentials
  • EC2 metadata (including v2 - IMDS)

Here is an example on how to obtain credentials:

> Credentials = aws_credentials:get_credentials().
[...]
> #{ access_key_id := AccessKeyId
   , token := Token
   , region := Region
   , secret_access_key := SecretAccessKey } = Credentials.

The aws_credentials application can be installed by adding the following to your rebar.config:

{deps, [{aws_credentials, "0.1.0"}]}.

Development

The service-specific modules are generated using the aws-codegen library from the JSON descriptions of AWS services provided by Amazon.

The rest of the code is manually written and used as support for the generated code.

Documentation

Check it Online

Build it locally

Add the rebar3_docs plugin to your global rebar3 config in ~/.config/rebar3/rebar.config:

{plugins, [rebar3_docs]}.

Then simply:

$ rebar3 docs

The docs will be available in ./doc.

Running Tests

$ rebar3 eunit

License

Copyright 2015 Jamshed Kakar [email protected]

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

aws-erlang's People

Contributors

ferd avatar jadeallenx avatar jcomellas avatar jfacorro avatar jkakar avatar jmettes avatar mikpe avatar philss avatar robertoaloi avatar ypaq avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.