Slide 1

Slide 1 text

Faster with Serverless:
 Building production-ready applications

Slide 2

Slide 2 text

About me Aleksandar Simovic Senior Software Engineer @ ScienceExchange • Co-author of “Serverless Applications with Node.js” 
 Book published by Manning Publications • AWS Serverless Hero • Core team member @ Claudia.js • Co-organizer of JS Belgrade (~1950 members) • Co-organizer of Serverless Belgrade • Organizer of Map Meetup Belgrade (Wardley Maps) • Writing on Serverless.Pub, streaming on Twitch, building Jarvis

Slide 3

Slide 3 text

Why are we here

Slide 4

Slide 4 text

Time for a story…

Slide 5

Slide 5 text

A story of a startup

Slide 6

Slide 6 text

The startup • Series A, B • Double digit billion dollar market • Traction of >100,000 customers • Innovative, disruptive… you name it • A-team talent, problem solving (10 engineers) • Customer-driven • Diverse customer base, world-wide

Slide 7

Slide 7 text

Architecture Overview

Slide 8

Slide 8 text

Reasonable enough?

Slide 9

Slide 9 text

Actually… No. • Unpredictable growth with scarce resources • Customers stuck, failing pilot programs • Night calls, crashes, scalability issues • Spending ~20% of backend developer time on infrastructure • So much overtime • Communication issues

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

“Oh, but we think we told you that there’s a demo tomorrow”

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

“Why don’t you just 
 scale it up a notch?”

Slide 14

Slide 14 text

Startups and financing • Money is scarce • Every decision has a high opportunity cost • Multiple stages cost a lot 
 (developers, management, investors, customers, 
 pilot programs) • Wasting ~20% of backend developer time on preparing demos, pilot programs, infrastructure

Slide 15

Slide 15 text

Average usage (per server)

Slide 16

Slide 16 text

Unexpected peak? New customers?

Slide 17

Slide 17 text

We didn’t serve our new customers!

Slide 18

Slide 18 text

Peak + a Buffer = The new setup

Slide 19

Slide 19 text

If we just reverse it?

Slide 20

Slide 20 text

Average waste (per server)

Slide 21

Slide 21 text

~ 62.8% Waste was on average ($40,000 wasted per year)

Slide 22

Slide 22 text

But that’s how it should be!

Slide 23

Slide 23 text

Your customer 
 doesn’t care
 
 They didn’t get served.

Slide 24

Slide 24 text

Your investors 
 didn’t care
 
 You failed to serve the customers
 (and you lost the revenue) (and you wasted the investment)

Slide 25

Slide 25 text

The main problems • Slow feature development cycles • Bad capacity planning • Wasting resources • Miscommunication • No investment • Slow pivoting

Slide 26

Slide 26 text

Customer doesn’t care

Slide 27

Slide 27 text

Why should you care?

Slide 28

Slide 28 text

Being a developer is not easy • Lots of responsibilities • Increasing complexity • Everyone wants everything done “yesterday” • Constantly learning • Build a “production-ready” application, where if something goes wrong, its your fault • Lots of “smart-a**es” telling you what to do (including me)

Slide 29

Slide 29 text

What does the customer care about Have an application that: • Runs • Stable • Scales • Satisfies requirements • Can withstand heavy-loads from day one • Short Time to Market

Slide 30

Slide 30 text

That means that production ready applications are…

Slide 31

Slide 31 text

Production-ready applications Apps that satisfy: • Operational Excellence • Security • Reliability • Performance Efficiency • Cost Optimization • Compliance AWS Well-Architectured white paper

Slide 32

Slide 32 text

How would I do a startup now

Slide 33

Slide 33 text

Serverless • No server management, operations, provisioning • Never pay for idle • Scales per usage • Available, resilient with built-in fault tolerance

Slide 34

Slide 34 text

Serverless

Slide 35

Slide 35 text

It is serverless the same way, the WiFi is wireless. Gojko Adzic

Slide 36

Slide 36 text

Event listeners

Slide 37

Slide 37 text

Not just AWS Lambda And so many more…

Slide 38

Slide 38 text

Remember this?

Slide 39

Slide 39 text

Serverless scales with your usage

Slide 40

Slide 40 text

But I’m special…

Slide 41

Slide 41 text

Are you sure?

Slide 42

Slide 42 text

But I want to be in control…

Slide 43

Slide 43 text

Pick two Control Productivity Scale

Slide 44

Slide 44 text

What about compliance? Out-of-the-box: • HIPAA • PCI • SOC1, SOC2

Slide 45

Slide 45 text

What about security? How many of you have fixed or applied a patch • Spectre • Meltdown 
 
 on the 3rd of January 2018?

Slide 46

Slide 46 text

How to start?

Slide 47

Slide 47 text

Serverless Bootstrap Tools

Slide 48

Slide 48 text

Serverless Bootstrap Tool Details

Slide 49

Slide 49 text

Why these tools?

Slide 50

Slide 50 text

AWS AppSync

Slide 51

Slide 51 text

• Serverless backend for web and mobile applications • Robust GraphQL APIs including schema, resolvers, and databases • Client support for offline & subscriptions for real-time capabilities. • Available for Web, iOS, Android AWS AppSync

Slide 52

Slide 52 text

AWS Amplify

Slide 53

Slide 53 text

JavaScript library for app development using cloud-services • APIs & serverless logic • GraphQL Client • Secure Authentication and Authorization • Analytics • Streaming and Real-Time data • Push Notifications • Storage / S3 • Internationalization AWS Amplify

Slide 54

Slide 54 text

Integrates with the major frontend frameworks • React.js • React Native • Angular.js • Vue.js AWS Amplify

Slide 55

Slide 55 text

Why Amplify?

Slide 56

Slide 56 text

import { Auth } from ‘aws-amplify’ Auth.signUp({…credentials}) Auth.signIn(username, password) Auth? - AWS Cognito

Slide 57

Slide 57 text

import { withAuthenticator } from ‘aws-amplify-react-native’ export default withAuthenticator(App) Mobile Authenticator?

Slide 58

Slide 58 text

import { Analytics } from ‘aws-amplify-react-native’ Analytics.record(‘Button Pressed!’) Analytics - AWS Pinpoint

Slide 59

Slide 59 text

import { Storage } from ‘aws-amplify-react-native’ Storage.get(‘hello-athens.jpg’) Storage - AWS S3

Slide 60

Slide 60 text

import { API } from ‘aws-amplify’ let apiName = ‘HellasAPI’ let path = ‘/hello-hellas’
 
 API.get(apiName, path)
 .then(response => console.log(response)) API - Amazon API Gateway

Slide 61

Slide 61 text

import { API, graphqlOperation } from ‘aws-amplify’
 
 API.configure(
 graphql_endpoint: ‘https://exampleendpoint.com’
 )
 
 const oneEvent = await API.graphql(graphqlOperation(GetEvent, {id: 22})) API - GraphQL

Slide 62

Slide 62 text

And many more…

Slide 63

Slide 63 text

AWS Serverless Application Repository

Slide 64

Slide 64 text

• Prebuilt serverless components • Instantly deployable into your account • Instantly attachable to existing apps using Nested Apps • Copy as SAM resource • Can publish and share your own AWS Serverless Application Repository

Slide 65

Slide 65 text

Stop and show me,
 who uses it and how

Slide 66

Slide 66 text

No content

Slide 67

Slide 67 text

No content

Slide 68

Slide 68 text

Real world case #1

Slide 69

Slide 69 text

• >200,000 requests per hour • Migrated all preprocessors into serverless functions • Node.js, using Claudia.js • Depend on unpredictable peaks • Significant cost reduction • Migration done by their frontend engineers

Slide 70

Slide 70 text

Real world case #2

Slide 71

Slide 71 text

• 500,000 users per month • ~$107 / month. • Company size of two people • Migration took around a month MindMup

Slide 72

Slide 72 text

Real world case #3

Slide 73

Slide 73 text

ScienceExchange • Integration with an accounting reports service • Constant influx of events • The accounting service product costs $100,000 / year • Necessary for finance, data science and analytics teams • Decided to build the project in-house 
 (estimation 3 months)

Slide 74

Slide 74 text

ScienceExchange

Slide 75

Slide 75 text

ScienceExchange Result • Saving $99,990 / year • Development took 2 weeks • Scales automatically • Operational costs: $0.09 per GB

Slide 76

Slide 76 text

Key takeaways • Serverless helps us focus on our business core • Scale your services, not yourself • Serverless is much more than AWS Lambda, FaaS • Enterprises and startups alike are both adopting serverless • Serverless helps us easily develop and build applications that are able to withstand heavy-loads from day one.

Slide 77

Slide 77 text

Q&A Thank you! 40% discount 
 using
 
 claudia40
 
 More at:
 serverless.pub 
 
 Twitter:
 @simalexan