Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

How to Use AWS Lambda Layers and Lambda Runtime

128 views

Published on

Originally presented at AWS User Group Bandung, Indonesia. In this session, let's learn how to use AWS Lambda layers and Lambda Runtimes. Including live demo(s) on how to build your own custom runtime and usage of Lambda layers.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

How to Use AWS Lambda Layers and Lambda Runtime

  1. 1. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Donnie Prakoso, MSc AWS Technology Evangelist, ASEAN How to Use AWS Lambda Layers and Lambda Runtime @donnieprakoso donnieprakoso
  2. 2. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark > hello, world Donnie Prakoso, MSc AWS Technology Evangelist @donnieprakoso donnieprakoso • Speak in Go and Python • Container, Machine Learning and Serverless • I AWS User Groups #TEMENNYAPETRA
  3. 3. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark What we’re going to talk today • Quick review on serverless • Previously on AWS Lambda • Introducing AWS Lambda Layers and Lambda Runtime • Few ideas on best practices
  4. 4. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Serverless Means … No servers to provision or manage Scales with usage Never pay for idle Built in availability and fault tolerance
  5. 5. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Services for Building Serverless Applications AWS Lambda Amazon DynamoDB Amazon SNS Amazon API Gateway Amazon SQS Amazon Kinesis Amazon S3 Compute and API Proxy AWS X-Ray AWS Step Functions Datastores, Storage, Orchestration, Analytics, Interprocess Messaging Developer Tools AWS CodeBuild AWS CodePipeline AWS Serverless Application Model (SAM) Open Source and third parties Lambda@Edge AWS Cloud9 Amazon Aurora Serverless (preview) AWS AppSync
  6. 6. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Serverless Applications Services (anything) Changes in data state Requests to endpoints Changes in resource state Event source Lambda function Node.js Python Java C# Go
  7. 7. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Focus on building business logic. !
  8. 8. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark BUSINESS LOGIC LIB A LIB B BUSINESS LOGIC LIB A LIB B BUSINESS LOGIC LIB A LIB B BUSINESS LOGIC LIB A LIB B Previously on AWS Lambda
  9. 9. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark How? • How about common functions? • How to separate lib, modules, frameworks? • How to share common libs?
  10. 10. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Extend the Lambda execution environment with any binaries, dependencies, or runtimes Lambda Layers BUSINESS LOGIC LIB A LIB B BUSINESS LOGIC LIB A LIB B BUSINESS LOGIC LIB A LIB B BUSINESS LOGIC LIB A LIB B Programming Model Before BUSINESS LOGIC BUSINESS LOGIC BUSINESS LOGIC BUSINESS LOGIC LIB A LIB B After
  11. 11. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Business Logic{} CI/CD for App & Dependencies Streamline Development with AWS Lambda, Layers and Runtime APP Sourc e Build Test Deplo y{} Source Build Test Deploy Lambda Layer Lambda Layer Lambda Layer Sourc e Build Test Deplo y Sourc e Build Test Deplo y {} {} LIBRARIES
  12. 12. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Languages Lambda support for Ruby + Bring any Linux compatible language runtime; Powered by new Runtime API - Codifies the runtime calling conventions and integration points Same technology powering Ruby support in AWS Lambda Bring any Linux compatible language runtime Custom Runtimes + AWSOPENSOURCE o f f e r e d b y o f f e r e d b y o f f e r e d b y o f f e r e d b y PARTNERSUPPORTED
  13. 13. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark UNDER THE HOOD - How does custom runtimes work? 1 • Retrieve settings 2 • Initialize the function 3 • Handle errors 1 • Get event 2 • Tracing 3 • Handle errors 4 • Invoke function 5 • Response handling 6 • Error handling 7 • Cleanup Processing TasksInitialization Tasks bootstrapBuild runtime
  14. 14. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Lambda Runtime API - Runtime Interactions • POST /runtime/init/error • GET /runtime/invocation/next • The invocation-id is in the Lambda-Runtime-Aws-Request-Id header • For AWS X-Ray there is a tracing header Lambda-Runtime-Trace-Id • POST /runtime/invocation/{invocation-id}/response • POST /runtime/invocation/{invocation-id}/error • Sample Endpoint + Resource Path • http://${AWS_LAMBDA_RUNTIME_API}/2018-06- 01/runtime/invocation/next
  15. 15. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Image credit to BukaLapak
  16. 16. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Open Source Runtimes • C++ (AWS) • Rust (AWS) • Erlang (AlertLogic) • Elixir (AlertLogic) • Cobol (Blu Age) • Node.js (NodeSource N|Solid) • PHP (Stackery)
  17. 17. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Wrapping Up • Experiments! • Lambda Layers help you to simplify your system by enforcing separation of concerns. Dependencies or business logic? • Use existing available Lambda Layer and if it doesn’t suit your needs… build one! • Bring your own interpreter for any language of your choice
  18. 18. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Go Build! Donnie Prakoso AWS Technology Evangelist, ASEAN @donnieprakoso donnieprakoso

×