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

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

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

What can you do with AWS Lambda@Edge, exactly? Alex will discuss the most interesting use cases and a few preview-related limitations. You will learn how to execute serverless functions at CloudFront's Edge Locations to implement unique functionalities and optimize network latency.


Alex Casalboni

April 17, 2017


  1.­‐edge-­‐sea.le AWS  Lambda@Edge  (Preview) Serverless  &  Originless  on  AWS 4/17/2017

  2. About  Me @alex_casalboni­‐edge-­‐sea.le Computer  Science  Background Sr.  SoDware  Engineer

     &  Web  Developer Cloud  Evangelist  @  Cloud  Academy Serverless  Italy  Meetup  Co-­‐Organizer
  3. Agenda What  is  Lambda@Edge? Benefits  and  use  cases Preview  &

     GA My  personal  experiment­‐edge-­‐sea.le
  4. What  is  Lambda@Edge? How  does  it  work  and  how’s  it

     different  from  AWS  Lambda?­‐edge-­‐sea.le
  5. AWS  Lambda  &  Regions us-­‐east-­‐1­‐edge-­‐sea.le

  6. AWS  Lambda  &  Regions us-­‐east-­‐1 eu-­‐west-­‐1­‐edge-­‐sea.le

  7. AWS’s  CDN  &  PoPs 70+  PoPs­‐edge-­‐sea.le

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

     (cache) 70+  Edge  LocaQons Custom  SSL  &  domain  name Cache  InvalidaQon AnalyQcs  dashboard Custom  origins  (e.g.  EC2) Supports  cookies  &  querystrings­‐edge-­‐sea.le
  9. Hits/Misses/Errors­‐edge-­‐sea.le

  10. Lambda@Edge  Architecture­‐edge-­‐sea.le

  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­‐edge-­‐sea.le
  12. Benefits  and  use  cases Use  cases  categorisa@on  and  analysis­‐edge-­‐sea.le

  13. AWS  Lambda@Edge  Use  cases Request/Response  manipulaQon Dynamic  content  generaQon Pure

     latency  opQmizaQon­‐edge-­‐sea.le
  14. 1.  Request/Response  manipulaPon Custom  HTTP  headers Adapt  to  client  capabiliQes

    Add  Qmezone-­‐related  info A/B  tesQng URL  rewriQng  /  redirects EncrypQon  at  the  Edge­‐edge-­‐sea.le
  15. 2.  Dynamic  content  generaPon  * Custom  error  pages Custom  signup

     forms Opzimized  JS  code  ( Dynamic  HTML *  Never  hit  the  origin!­‐edge-­‐sea.le
  16. 3.  Pure  latency  opPmizaPon  * 401  errors  (if  missing  auth)

    Edge-­‐based  logging Custom  data  validaQon Custom  data  transformaQon *  Assuming  dynamic  origin­‐edge-­‐sea.le
  17. Preview  &  GA What  about  Preview  limita@ons,  GA,  and  pricing?­‐edge-­‐sea.le
  18. LimitaPons  (preview  only) Max  50ms Only  128MB  (RAM) Only  1MB

     of  code Only  Node.js  4.3 Programming  model Only  1  trigger­‐edge-­‐sea.le
  19. LimitaPons  (permanent) Cold  starts Only  Node.js No  VPC No  API

     Gateway  distribuQons Slow  propagaQon  (~5min) No  real-­‐Qme  logging­‐edge-­‐sea.le No  DLQ Explicit  HTTP  convenQons
  20. General  Availability  (soon!) HTTP  calls  /  AWS  SDK Dynamic  Content!  (3rd-­‐party)  monitoring More  RAM,  Qme,  and  storage­‐edge-­‐sea.le MulQple  triggers  LocaQon  awareness
  21. Lambda@Edge  Pricing $0.60  /  1M  calls  (requests) $1.00  /  3M

     calls  (duraQon) No  Free  Tier 50ms  granularity­‐edge-­‐sea.le Example:  6M  calls  ~  $5.6
  22. My  personal  experiment Finally  some  code  :)­‐edge-­‐sea.le

  23. Render  dynamic  HTML  with  Lambda@Edge <  origin-­‐less  demo  >­‐edge-­‐gist­‐edge-­‐demo­‐edge-­‐sea.le
  24. Thank  you  =) Q  &  A 4/17/2017­‐edge-­‐sea.le