Slide 1

Slide 1 text

@srhtcn Serverless Architectures at AWS Lambda: The Experience Serhat Can @srhtcn

Slide 2

Slide 2 text

@srhtcn Who am I? ● Ex-Software Engineer Technical Evangelist at OpsGenie ● Speak, code, write on DevOps, On-Call, Incident Response, Serverless ● Co-organizer ○ Serverless Turkey Meetup ○ DevOpsDays İstanbul ○ DevOps Turkey Meetup

Slide 3

Slide 3 text

@srhtcn Modern incident management platform for operating always-on services ● Plan and prepare for incidents ● Ensure issues are never missed, and the right people are notified ● Gain insights to improve your operational efficiency ● 200+ integrations

Slide 4

Slide 4 text

@srhtcn You want to run code on cloud. Your options: Bare metal IaaS (VM) CaaS (container) PaaS (app) Serverless (function) More control, more code Less control, less code

Slide 5

Slide 5 text

@srhtcn Making thoughtful decisions about tools and architecture can help; well-considered constraints can free us from the decisions that aren't bringing us distinguishable benefit. Bridget Kromhout https://queue.acm.org/detail.cfm?id=3185224

Slide 6

Slide 6 text

@srhtcn What is Serverless?

Slide 7

Slide 7 text

@srhtcn Defining Serverless Serverless is an event driven, utility based, stateless, code execution environment. Simon Wardley @swardley

Slide 8

Slide 8 text

@srhtcn Defining Serverless Event driven: Code is initiated and run after an event like HTTP request or storage of a file triggers.

Slide 9

Slide 9 text

@srhtcn Defining Serverless Event driven: Code is initiated and run after an event like HTTP request or storage of a file triggers. Utility based: No payment for idle time or hosting. You pay for the resources you use when your code is triggered.

Slide 10

Slide 10 text

@srhtcn Defining Serverless Event driven: Code is initiated and run after an event like HTTP request or storage of a file triggers. Utility based: No payment for idle time or hosting. You pay for the resources you use when your code is triggered. Stateless: Code execution environment is deconstructed after sometime. No information is guaranteed to stay in the environment after function execution is completed.

Slide 11

Slide 11 text

@srhtcn Defining Serverless Event driven: Code is initiated and run after an event like HTTP request or storage of a file triggers. Utility based: No payment for idle time or hosting. You pay for the resources you use when your code is triggered. Stateless: Code execution environment is deconstructed after sometime. No information is guaranteed to stay in the environment after function execution is completed. Code execution: Just code, not servers / VMs / containers etc.

Slide 12

Slide 12 text

@srhtcn Why should I go Serverless? Two main reasons

Slide 13

Slide 13 text

@srhtcn Less is more Less code to maintain, less ops, less toil (work tied to running a production service that tends to be manual, repetitive) - Scaling - Provisioning - OS or Language updates - Resource utilization - Network monitoring - Fault tolerance - Shipping logs https://landing.google.com/sre/book/chapters/eliminating-toil.html

Slide 14

Slide 14 text

@srhtcn

Slide 15

Slide 15 text

@srhtcn Economics - No payment for idle time or hosting - Easy to get started - Faster time to market

Slide 16

Slide 16 text

@srhtcn AWS Lambda

Slide 17

Slide 17 text

@srhtcn How it works?

Slide 18

Slide 18 text

@srhtcn How it works internally? https://engineering.opsgenie.com/what-is-different-in-the-serverless-world-b9e0f68de191

Slide 19

Slide 19 text

@srhtcn Pricing You choose memory size % of CPU core and network capacity increases proportionally with memory More memory doesn’t always mean you pay more

Slide 20

Slide 20 text

@srhtcn https://www.slideshare.net/ChrisMunns/aws-startup-day-boston-2018-the-best-practices-and-hard-lessons-learned-of-serverless-applications

Slide 21

Slide 21 text

@srhtcn Supported event sources 20 different services can trigger AWS Lambda functions including. Event sources that aren't stream-based: Synchronous invocation: AWS SDK, Cognito, Alexa, API Gateway Asynchronous invocation: S3, SNS, CloudWatch logs, CloudWatch events Poll-based (or pull model) event sources that are stream-based: Kinesis, DynamoDB Streams Poll-based event sources that are not stream-based: SQS

Slide 22

Slide 22 text

@srhtcn Toolkit around AWS Lambda Orchestration: Step Functions Deployment: SAM, Serverless.js, CloudFormation, Apex, Terraform Monitoring: Cloudwatch, X-Ray, Thundra Marketplace: AWS Serverless Application Repository

Slide 23

Slide 23 text

@srhtcn AWS Lambda at OpsGenie AWS Lambda with Java 8 DynamoDB SQS SNS VPC Serverless.js

Slide 24

Slide 24 text

@srhtcn Fast scaling under immediate high load Under-utilized machines Operational complexity Learning curve - kubernetes? AWS Fargate - YES! Why did we consider AWS Lambda?

Slide 25

Slide 25 text

@srhtcn OpsGenie’s Serverless journey 2015 Writing small scale custom integrations At this point, we started leveraging AWS Lambda to help our customer run custom code

Slide 26

Slide 26 text

@srhtcn OpsGenie’s Serverless journey 2015 Writing small scale custom integrations At this point, we started leveraging AWS Lambda to help our customer run custom code First production usage Started using AWS Lambda for leveraging async / not business critical jobs such as DynamoDB autoscale 2016

Slide 27

Slide 27 text

@srhtcn OpsGenie’s Serverless journey 2015 Writing small scale custom integrations At this point, we started leveraging AWS Lambda to help our customer run custom code First production usage Started using AWS Lambda for leveraging async / not business critical jobs such as DynamoDB autoscale 2016 Service and Incident Management A new customer facing feature running on AWS Lambda integrated with the rest of the code base. 2017

Slide 28

Slide 28 text

@srhtcn OpsGenie’s Serverless journey 2015 Writing small scale custom integrations At this point, we started leveraging AWS Lambda to help our customer run custom code First production usage Started using AWS Lambda for leveraging async / not business critical jobs such as DynamoDB autoscale 2016 Service and Incident Management A new customer facing feature running on AWS Lambda integrated with the rest of the code base. 2017 A Spinoff: Thundra Observability for AWS Lambda 2018

Slide 29

Slide 29 text

@srhtcn Fixing “it is slow” is harder in AWS Lambda Too many moving pieces No way to attach an agent Even how to send the monitoring data is a discussion point

Slide 30

Slide 30 text

@srhtcn Determine the latency in different levels Automatic instrumentation GC, Thread counts & durations, CPU usage details Get the stack trace in case of an error and drill down See logs, traces, and metrics in one view thundra.io What we needed was

Slide 31

Slide 31 text

@srhtcn Serverless Architectures

Slide 32

Slide 32 text

@srhtcn Alert Enrichment

Slide 33

Slide 33 text

@srhtcn DynamoDB Cross Region Replication

Slide 34

Slide 34 text

@srhtcn DynamoDB Auto Scale

Slide 35

Slide 35 text

@srhtcn Service and Incident Management

Slide 36

Slide 36 text

@srhtcn Demo: Create Alerts from Slack Messages Source: https://github.com/opsgenie/slack-to-opsgenie-alert-creator

Slide 37

Slide 37 text

@srhtcn Thank you! Serhat Can twitter.com/srhtcn linkedin.com/in/serhatcan medium.com/@serhatcan engineering.opsgenie.com