Slide 1

Slide 1 text

Serverless Architecture with AWS lambda @itsmemattchung

Slide 2

Slide 2 text

Agenda • Brief background about me • Use Case / Problem • Live Demo • Lessons Learned

Slide 3

Slide 3 text

About Me Roots in systems and networking. Primary focus is software development • Engineer @ Cisco Systems • Director.Technical Operations @ Fox Networks (NewsCorp / 21st Century Fox) • Python / DevOps @ Whalerock Industries

Slide 4

Slide 4 text

What problem are we trying to solve? • Scheduled tasks • Existing solutions • Cron • Celery beat • RQ

Slide 5

Slide 5 text

What is AWS Lambda "... a compute service where you can upload your code to AWS Lambda and the service can run the code on your behalf using AWS infrastructure."1 -- AWS Developer Guide 1 https:/ /forums.aws.amazon.com/message.jspa?messageID=619362

Slide 6

Slide 6 text

Attending AWS re:Invent 2015 • Python / Django shop - Celery Beat with single instance scheduler • Lambda as Cron: Scheduling Invocations in AWS Lambda • Using CloudWatch to trigger alarm • SNS topic to trigger AWS Lambda There's got to be an EASIER way

Slide 7

Slide 7 text

AWS Announces support for Cron

Slide 8

Slide 8 text

A few Core Principles • Pre-production (i.e "DEV", "QA") and production environments • Application logging • Monitoring / Notifications • Easy to deploy

Slide 9

Slide 9 text

Live Demo • Trigger web performance tests on a scheduled basis using SpeedCurve API. Sample application • Build • Deploy • Execute

Slide 10

Slide 10 text

How to separate environments Each function is its own "environment" • DeploySpeedCurve-dev • DeploySpeedCurve-staging • DeploySpeedCurve-production

Slide 11

Slide 11 text

Use Case: Log Ingestion service • Akamai Netstorage • AWS Lambda • SumoLogic

Slide 12

Slide 12 text

Things I wished I knew before • Language support • Limitations

Slide 13

Slide 13 text

Example code var path = require('path'); path.parse(logfileToUpload) .... TypeError: Object # has no method 'parse' Worked locally, but NOT on AWS Lambda

Slide 14

Slide 14 text

Supported Languages • Node.js: v0.10.36 • Java: Java 8 • Python: Python 2.7

Slide 15

Slide 15 text

Limitations

Slide 16

Slide 16 text

How to separate environments Environment Variables

Slide 17

Slide 17 text

How to separate environment variables (part 2) • Download .env-$ENVIRONMENT from S3 • Invoke Build Process

Slide 18

Slide 18 text

How much did we spend the last month?

Slide 19

Slide 19 text

Key Takeaways • Treat file system as ephemeral • What language version are you running?

Slide 20

Slide 20 text

Resources How to create a deployment package http:/ /docs.aws.amazon.com/lambda/latest/dg/lambda-python-how- to-create-deployment-package.html AWS Lambda Limits http:/ /docs.aws.amazon.com/lambda/latest/dg/limits.html Supported Language Versions http:/ /docs.aws.amazon.com/lambda/latest/dg/current-supported- versions.html

Slide 21

Slide 21 text

Contact Email: [email protected] GitHub / Twitter : @itsmemattchung