Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Deploying with Apex

Deploying with Apex

How FundApps deploys AWS Lambda functions across accounts taking into consideration workflow, CI and security.

David Blooman

February 01, 2017

Transcript

62 slides
  1. • Batteries included but optional • Environment variable population via

    command-line, file, or inline config • Multiple environments via project.ENV.json and function.ENV.json files
  2. • Transparently generates a zip for your deploy • Ignore

    deploying files with .apexignore • Function rollback support
  3. { "name": "demo", "description": "demo for meetup", "memory": 128, "timeout":

    5, "role": "arn:aws:iam::00000000:role/lambda_function", "environment": {} } /project.json
  4. { "name": "function1", "description": "demo for meetup", "memory": 256, "timeout":

    5, "role": "arn:aws:iam::00000000:role/lambda_function", "environment": {} } /function.json
  5. resource "aws_lambda_function" "test_lambda" { filename = "lambda_function_payload.zip" function_name = "lambda_function_name"

    role = "${aws_iam_role.iam_for_lambda.arn}" handler = "exports.test" source_code_hash = "${base64sha256(file("function_payload.zip"))}" environment { variables = { foo = "bar" } } }
  6. Single point of truth • Consul • KMS • Etcd

    • Zookeeper • S3 • Credstash • CI server
  7. exports.handler = (event, context, callback) => { if (decrypted) {

    processEvent(event, context, callback); } else { const kms = new AWS.KMS({ region: 'eu-west-1' }); kms.decrypt({ CiphertextBlob: new Buffer(encrypted, 'base64') }, (err, data) => { if (err) { console.log('Decrypt error:', err); return callback(err); } decrypted = data.Plaintext.toString('ascii'); processEvent(event, context, callback); }); }
  8. Value Axis 0ms 300ms 600ms 900ms 1200ms 1 2 3

    4 5 6 7 8 9 10 11 12 13 14 15 Node w/ KMS Node w/o KMS
  9. 0ms 4.5ms 9ms 13.5ms 18ms 2 3 4 5 6

    7 8 9 10 11 12 13 14 15 Node w/ KMS Node w/o KMS
  10. 0ms 500ms 1000ms 1500ms 2000ms 1 2 3 4 5

    6 7 8 9 10 Node w/ KMS Node w/o KMS Go w/ KMS Go w/o KMS
  11. 0ms 75ms 150ms 225ms 300ms 2 3 4 5 6

    7 8 9 10 Node w/ KMS Node w/o KMS Go w/ KMS Go w/o KMS

Other Decks in Technology