Save 37% off PRO during our Black Friday Sale! »

Serverless London - Lambda@Edge (Serverless & Originless on AWS)

Serverless London - Lambda@Edge (Serverless & Originless on AWS)

What can you do with AWS Lambda@Edge? Learn how to execute serverless functions on CloudFront Edge locations in response to CloudFront events to optimize network latency.

36ca8ae7e19067021d0e39c0b72acc2a?s=128

Alex Casalboni

April 05, 2017
Tweet

Transcript

  1. clda.co/lambda-­‐edge-­‐london AWS  Lambda@Edge  (Preview) Serverless  &  Originless  on  AWS 4/5/2017

  2. About  Me @alex_casalboni clda.co/lambda-­‐edge-­‐london Computer  Science  Background Master  in  Sound

     &  Music  Engineering Sr.  SoEware  Engineer  &  Web  Developer Cloud  Evangelist  @  Cloud  Academy
  3. Agenda What  is  Lambda@Edge? Benefits  and  use  cases Preview  limitaKons

    My  personal  experiment clda.co/lambda-­‐edge-­‐london
  4. What  is  Lambda@Edge? How  does  it  work  and  how’s  it

     different  from  AWS  Lambda? clda.co/lambda-­‐edge-­‐london
  5. AWS  Lambda  &  Regions us-­‐east-­‐1 clda.co/lambda-­‐edge-­‐london

  6. AWS  Lambda  &  Regions us-­‐east-­‐1 eu-­‐west-­‐1 clda.co/lambda-­‐edge-­‐london

  7. AWS’s  CDN  &  PoPs 70+  PoPs clda.co/lambda-­‐edge-­‐london

  8. Amazon  CloudFront StaKc  content  (web  assets,  videos,  etc.) Dynamic  content

     (cache) 70+  Edge  LocaKons Custom  SSL  &  domain  name Cache  InvalidaKon AnalyKcs  dashboard Custom  origins  (e.g.  EC2) Supports  cookies  &  querystrings clda.co/lambda-­‐edge-­‐london
  9. Hits/Misses/Errors clda.co/lambda-­‐edge-­‐london

  10. Lambda@Edge  Architecture clda.co/lambda-­‐edge-­‐london

  11. CloudFront  Triggers Viewer  Request Viewer  Response Origin  Request Origin  Response

    Before  cache  hit/miss A8er  cache  hit/miss Only  if  cache  miss,  before  forwarding Only  if  cache  miss,  a8er  forwarding clda.co/lambda-­‐edge-­‐london
  12. Benefits  and  use  cases Use  cases  categorisa@on  and  analysis clda.co/lambda-­‐edge-­‐london

  13. AWS  Lambda@Edge  Use  cases Request/Response  manipulaKon Dynamic  content  generaKon Pure

     latency  opKmizaKon clda.co/lambda-­‐edge-­‐london
  14. 1.  Request/Response  manipulaQon Custom  HTTP  headers Adapt  to  client  capabiliKes

    Add  Kmezone-­‐related  info A/B  tesKng URL  rewriKng  /  redirects Cookies  manipulaKon clda.co/lambda-­‐edge-­‐london
  15. 2.  Dynamic  content  generaQon  * Custom  error  pages Custom  signup

     forms Opzimized  JS  code  (Polyfill.io) Dynamic  HTML *  Never  hit  the  origin! clda.co/lambda-­‐edge-­‐london
  16. 3.  Pure  latency  opQmizaQon  * 401  errors  if  missing  auth

    Custom  edge-­‐based  logging Custom  data  validaKon Custom  data  transformaKon *  Assuming  dynamic  origin clda.co/lambda-­‐edge-­‐london
  17. Preview  limitaKons What  restric@ons  do  you  encounter  during  the  preview

     phase? clda.co/lambda-­‐edge-­‐london
  18. LimitaQons  (preview  only) Max  50ms Only  128MB  (RAM) Only  1MB

     of  code Only  Node.js  4.3 clda.co/lambda-­‐edge-­‐london Slightly  different   programming  model Manual  handling  of  HTTP   convenKons  (OPTIONS,  204,  etc.)
  19. LimitaQons  (permanent) No  HTTP  calls No  AWS  SDK No  VPC/DLQ

     config No  real-­‐Kme  logging No  3rd-­‐party  monitoring Slow  deploy  (up  to  15min) clda.co/lambda-­‐edge-­‐london
  20. My  personal  experiment Finally  some  code  :) clda.co/lambda-­‐edge-­‐london

  21. Render  dynamic  HTML  with  Lambda@Edge <  origin-­‐less  demo  > clda.co/lambda-­‐edge-­‐london

    clda.co/lambda-­‐edge-­‐gist clda.co/lambda-­‐edge-­‐demo
  22. Thank  you  =) clda.co/lambda-­‐edge-­‐london Q  &  A 4/5/2017