Build, deploy, and manage AWS Lambda functions with ease (with Go support!).
Go JavaScript Java Shell Clojure Rust Other
Latest commit 8ee6f3c Feb 15, 2017 TJ Holowaychuk Release v0.13.0
Permalink
Failed to load latest commit information.
.github add -ldebug to ISSUE_TEMPLATE Jun 19, 2016
_examples change clojure clean hook to not discard stderr Feb 15, 2017
archive fix symlink support. Closes #401 #288 (#404) May 11, 2016
assets add title.png Dec 14, 2016
boot Release v0.10.3 Sep 5, 2016
cmd/apex Release v0.13.0 Feb 15, 2017
colors add colors package Jan 29, 2016
cost Add metric price (#368) Apr 17, 2016
docs Release v0.13.0 Feb 15, 2017
dryrun remove deadcode Mar 17, 2016
exec ocd Dec 29, 2016
function Clojure support (#674) Feb 15, 2017
hooks add deploy hook Jan 24, 2016
infra add variable apex_function_NAME_name to the exported variable to terr… Jan 26, 2017
logs fix missing logs. Closes #393 May 5, 2016
metrics Add metric price (#368) Apr 17, 2016
mock fix mock Dec 14, 2016
plugins change java error to match clojure Feb 15, 2017
project Add alias on another alias (#653) Jan 23, 2017
shim Release v0.13.0 Feb 15, 2017
stats add basic analytics May 6, 2016
upgrade Use executable's path as the temp path (#488) Jul 17, 2016
utils refactor STS into util Dec 23, 2016
vpc add VPC support. Closes #242 Feb 15, 2016
.gitignore remove ignored extension Apr 15, 2016
CODE_OF_CONDUCT.md add CODE_OF_CONDUCT.md Feb 16, 2016
CONTRIBUTING.md add note about minimal golang version. Closes #410 May 11, 2016
History.md Release v0.13.0 Feb 15, 2017
LICENSE change license to Apex contributors Jan 17, 2016
Makefile add openbsd. Closes #307 Mar 5, 2016
Readme.md add kms_arn and deadletter_arn to docs Feb 15, 2017
install.sh Fix regex for older grep versions (#671) Feb 7, 2017

Readme.md

Apex Serverless Architecture

Apex lets you build, deploy, and manage AWS Lambda functions with ease. With Apex you can use languages that are not natively supported by AWS Lambda, such as Golang, through the use of a Node.js shim injected into the build. A variety of workflow related tooling is provided for testing functions, rolling back deploys, viewing metrics, tailing logs, hooking into the build system and more.

Installation

On macOS, Linux, or OpenBSD run the following:

curl https://raw.githubusercontent.com/apex/apex/master/install.sh | sh

Note that you may need to run the sudo version below, or alternatively chown /usr/local:

curl https://raw.githubusercontent.com/apex/apex/master/install.sh | sudo sh

On Windows download binary.

If already installed, upgrade with:

apex upgrade

Runtimes

Currently supports:

  • Node.js
  • Golang
  • Python
  • Java
  • Rust
  • Clojure

Example projects for all supported runtimes can be found in _examples directory.

Features

  • Supports languages Lambda does not natively support via shim, such as Go
  • Binary install (install apex quickly for continuous deployment in CI etc)
  • Hook support for running commands (transpile code, lint, dependency management , etc)
  • Batteries included but optional (opt-in to higher level abstractions)
  • Environment variable population via command-line, file, or inline config
  • Idempotent deployments (checksums skip already-deployed code)
  • Multiple environments via project.ENV.json and function.ENV.json files
  • Configuration inheritance and overrides
  • Command-line function invocation with JSON streams
  • Command & function name autocompletion
  • Function name globbing (ex: apex deploy api_*)
  • Transparently generates a zip for your deploy
  • Project bootstrapping with optional Terraform support
  • Function metrics and cost analysis
  • Ignore deploying files with .apexignore
  • Function rollback support
  • Tail function logs
  • Concurrency for quick deploys
  • Dry-run to preview changes
  • VPC support

Sponsors

Does your company use Apex? Help keep the project bug-free and feature rich by sponsoring the project.

Backers

Love our work and community? Become a backer.

Example

Apex projects are made up of a project.json configuration file, and zero or more Lambda functions defined in the "functions" directory. Here's an example file structure:

project.json
functions
├── bar
│   ├── function.json
│   └── index.js
└── foo
    ├── function.json
    └── index.js

The project.json file defines project level configuration that applies to all functions, and defines dependencies. For this simple example the following will do:

{
  "name": "example",
  "description": "Example project"
}

Each function uses a function.json configuration file to define function-specific properties such as the runtime, amount of memory allocated, and timeout. This file is completely optional, as you can specify defaults in your project.json file. For example:

{
  "name": "bar",
  "description": "Node.js example function",
  "runtime": "nodejs4.3",
  "memory": 128,
  "timeout": 5,
  "role": "arn:aws:iam::293503197324:role/lambda"
}

Now the directory structure for your project would be:

project.json
functions
├── bar
│   └── index.js
└── foo
    └── index.js

Finally the source for the functions themselves look like this in Node.js:

console.log('start bar')
exports.handle = function(e, ctx) {
  ctx.succeed({ hello: e.name })
}

Apex operates at the project level, but many commands allow you to specify specific functions. For example you may deploy the entire project with a single command:

$ apex deploy

Or whitelist functions to deploy:

$ apex deploy foo bar

Invoke it!

$ echo '{ "name": "Tobi" }' | apex invoke bar
{ "hello": "Tobi" }

See the Documentation for more information.

Links

Notes

Apex collects usage metrics by default to help inform the team, allowing us to determine how commands and flags are used (if ever). No sensitive information is sent, no function names or alias names etc. To get a better idea of what is tracked run:

$ grep -r stats.Track . -A 5

To opt-out at any time simply run:

$ touch ~/.apex/disable

Badges

Build Status Slack Status GoDoc OpenCollective OpenCollective


tjholowaychuk.com  ·  GitHub @tj  ·  Twitter @tjholowaychuk