Serverless Architecture with AWS Lambda

90d05761d7a5206db9ac0186c20d0e73?s=47 Matt Chung
November 27, 2015

Serverless Architecture with AWS Lambda

Lessons learned from utilizing AWS Lambda cron feature.

90d05761d7a5206db9ac0186c20d0e73?s=128

Matt Chung

November 27, 2015
Tweet

Transcript

  1. Serverless Architecture with AWS lambda @itsmemattchung

  2. Agenda • Brief background about me • Use Case /

    Problem • Live Demo • Lessons Learned
  3. 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
  4. What problem are we trying to solve? • Scheduled tasks

    • Existing solutions • Cron • Celery beat • RQ
  5. 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
  6. 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
  7. AWS Announces support for Cron

  8. A few Core Principles • Pre-production (i.e "DEV", "QA") and

    production environments • Application logging • Monitoring / Notifications • Easy to deploy
  9. Live Demo • Trigger web performance tests on a scheduled

    basis using SpeedCurve API. Sample application • Build • Deploy • Execute
  10. How to separate environments Each function is its own "environment"

    • DeploySpeedCurve-dev • DeploySpeedCurve-staging • DeploySpeedCurve-production
  11. Use Case: Log Ingestion service • Akamai Netstorage • AWS

    Lambda • SumoLogic
  12. Things I wished I knew before • Language support •

    Limitations
  13. Example code var path = require('path'); path.parse(logfileToUpload) .... TypeError: Object

    #<Object> has no method 'parse' Worked locally, but NOT on AWS Lambda
  14. Supported Languages • Node.js: v0.10.36 • Java: Java 8 •

    Python: Python 2.7
  15. Limitations

  16. How to separate environments Environment Variables

  17. How to separate environment variables (part 2) • Download .env-$ENVIRONMENT

    from S3 • Invoke Build Process
  18. How much did we spend the last month?

  19. Key Takeaways • Treat file system as ephemeral • What

    language version are you running?
  20. 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
  21. Contact Email: hello@itsmemattchung.com GitHub / Twitter : @itsmemattchung