Giter Club home page Giter Club logo

apex's Introduction

Apex

Apex is a small tool for deploying and managing AWS Lambda functions. With shims for languages not yet supported by Lambda, you can use Golang out of the box.

Installation

Download binaries or:

$ go get github.com/apex/apex/...

Runtimes

Currently supports:

  • Nodejs
  • Golang
  • Python

Features

  • Supports languages Lambda does not natively support via shim
  • Binary install (useful for continuous deployment in CI etc)
  • Command-line function invocation with JSON streams
  • Transparently generates a zip for your deploy

Example

This example shows how you can use Apex to launch a simple Node.js echo function.

First create the function implementation in "index.js".

exports.handle = function(e, ctx) {
  ctx.succeed(e)
}

Next create a "package.json" with the function name a configuration:

{
  "name": "echo",
  "description": "Echo request example",
  "runtime": "nodejs",
  "memory": 128,
  "timeout": 5
}

Create and deploy the function:

$ apex deploy

Create a file with a sample request "request.js":

{
  "event": {
    "hello": "world"
  },
  "context": {
    "user": "Tobi"
  }
}

Test out your new function:

$ apex invoke < request.json
{"hello":"world"}

Streaming input

The invoke sub-command allows you to stream input over stdin:

$ apex invoke < request.json

This not only works for single requests, but for multiple, as shown in the following example using phony(1):

$ echo -n '{ "event": { "user": "{{name}}" } }' | phony | apex invoke
{"user":"Delmer Malone"}
{"user":"Jc Reeves"}
{"user":"Luna Fletcher"}
...

Environment variables

Currently the following environment variables are used:

  • AWS_ACCESS_KEY AWS account access key
  • AWS_SECRET_KEY AWS account secret key
  • AWS_REGION AWS region

Links

License

MIT

apex's People

Contributors

tj avatar

Stargazers

 avatar  avatar

Watchers

 avatar  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.