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

Serverless, not infrastructureless

Serverless, not infrastructureless

Talk from CloudCamp, about the reality of serverless, and some questions about the future of specialisation and systems administration.

Gareth Rushgrove

July 06, 2017
Tweet

More Decks by Gareth Rushgrove

Other Decks in Technology

Transcript

  1. (without introducing more risk) Gareth Rushgrove Clojure hello world (ns

    net.morethanseven.hello (:gen-class :implements [com.amazonaws.services.lambda.runtime.RequestStreamHandler]) (:require [clojure.java.io :as io] [clojure.string :as str]) (:import (com.amazonaws.services.lambda.runtime Context))) (defn -handleRequest [this input-stream output-stream context] (let [handle (io/writer output-stream)] (.write handle (str "hello" "world")) (.flush handle)))
  2. (without introducing more risk) Gareth Rushgrove Javascript hello world exports.myHandler

    = function(event, context, callback) { callback(null, "Hello World"); }
  3. (without introducing more risk) Gareth Rushgrove Some required configuration… variable

    "aws_region" { description = "AWS Region Lambda function is deployed to" } variable "apex_environment" { description = "Apex configured environment. Auto provided by 'apex infra'" } variable "apex_function_role" { description = "Provisioned Lambda Role ARN via Apex. Auto provided by 'apex i } variable "apex_function_hub" { description = "Provisioned function 'hub' ARN information. Auto provided by ' } variable "apex_function_hub_name" { description = "Provisioned function 'hub' name information. Auto provided by }
  4. (without introducing more risk) Gareth Rushgrove …some more required configuration

    resource "aws_cloudwatch_event_rule" "every_five_minutes" { name = "every-five-minutes" description = "Fires every five minutes" schedule_expression = "rate(5 minutes)" } resource "aws_cloudwatch_event_target" "check_hub_every_five_minutes" { rule = "${aws_cloudwatch_event_rule.every_five_minutes.name}" target_id = "${var.apex_function_hub_name}" arn = "${var.apex_function_hub}" } resource "aws_lambda_permission" "allow_cloudwatch_to_call_hub" { statement_id = "AllowExecutionFromCloudWatch" action = "lambda:InvokeFunction" function_name = "${var.apex_function_hub_name}" principal = "events.amazonaws.com"
  5. For the 3 line Javascript function we needed 32 lines

    of configuration Gareth Rushgrove
  6. I had to care about CloudWatch event targets, event rules

    and Lambda permissions, all of which are platform specific Gareth Rushgrove
  7. (without introducing more risk) Gareth Rushgrove and more different configuration

    "EbsBackupSnapper": { "Type": "AWS::Lambda::Function", "DependsOn": [ "EbsBackupExecutionRole", "EbsBackupExecutionPolicy" ], "Properties": { "Code": { "S3Bucket": "demos.serverlesscode.com", "S3Key": "2015-11-ebs-snapshots/ebs-snapper.zip" }, "Role": { "Fn::GetAtt": ["EbsBackupExecutionRole", "Arn"] }, "Timeout": 60, "Handler": "lambda_function.lambda_handler", "Runtime": "python2.7",
  8. For the 33 line Python function we needed 100 lines

    of configuration Gareth Rushgrove
  9. I had to care about IAM policies and roles, which

    again are platform specific Gareth Rushgrove
  10. (without introducing more risk) Gareth Rushgrove Do we need better

    abstractions? */5 * * * * node /home/garethr/hello.js