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.
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lee Atkinson, Solutions Architect
25 September 2...
Agenda
Overview of AWS Lambda & Amazon CloudFront
Lambda@Edge: How it works, and when to use it
Demos of Lambda@Edge
AWS Lambda
AWS Lambda: Serverless computing
Run code without servers. Pay only for the compute time you consume. Be happy.
Triggered ...
Benefits of AWS Lambda
Continuous
scaling
No servers to
manage
Never pay for idle
– no cold servers
(only happy
accountant...
Amazon CloudFront
Amazon CloudFront Global Content Delivery Network
North America
Cities: 20, PoPs: 29
Ashburn, VA (3)
Atlanta, GA (3)
Bosto...
CloudFront Key Features
Accelerate static and dynamic content (websites, APIs)
Scalable and Global
Cache content closer to...
Your Application =
EC2, ELB, S3 Route 53, CloudFront, AWS WAF & Shield
HTML5, Mobile, Desktop
Origin+ Edge+ Client
…and La...
AWS Lambda@Edge
Introducing Lambda@Edge
Lambda@Edge is an extension of AWS Lambda that allows you to run Node.js
code at AWS global edge l...
Write once, run everywhere
CloudFront Triggers for Lambda@Edge
CloudFront Triggers for Lambda@Edge
CloudFront Triggers for Lambda@Edge
What Can Lambda@Edge Do?
Add/Remove/Modify request and response headers
Modify request URL path
Generate response
Access r...
Lambda compared to Lambda@Edge
Lambda Lambda@Edge
Languages Node.js, Python, C#, Java Node.js
Memory 128->1536MB 128MB
Exe...
Use cases
Usecases – Response generation
Multiple origins
Personalisation (e.g. ‘Lee’s Account’ in the top-left)
Results of multiple...
Usecases – HTTP Redirects
Cool URIs don’t change (…though they may redirect)
Redirect to latest version
Redirect example.c...
Usecases – URL Rewriting
Semantic (pretty) URLs
/foo-cms/view/42.asp -> /articles/42
Adaptive content
Client capabilities ...
Usecases – Security Best Practices
Add security response headers:
• Strict-Transport-Security
• Content-Security-Policy
• ...
Usecases –Authorization
Bot handling – using CAPTCHA
Non-standard authorization (not HTTP Basic/Digest/etc)
Origin doesn’t...
Usecases – A/B Testing
Test your theory on a proportion of users
Measure valuable metric (social likes/shares, engagement,...
Demo Time!
Summary
Lambda@Edge Summary
Features:
Header manipulation
URL rewrites
Response generation
Benefits:
Bring your own code
Familiar ...
Thank you!
Lee Atkinson, Solutions Architect
Upcoming SlideShare
Loading in …5
×

AWS Lambda@Edge Lightning Demos

737 views

Published on

AWS Lambda@Edge brings your AWS Lambda functions closer to your users by executing them on the Amazon network edge.

  • Be the first to comment

AWS Lambda@Edge Lightning Demos

  1. 1. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Lee Atkinson, Solutions Architect 25 September 2017 AWS Lambda@Edge Lightning Demos
  2. 2. Agenda Overview of AWS Lambda & Amazon CloudFront Lambda@Edge: How it works, and when to use it Demos of Lambda@Edge
  3. 3. AWS Lambda
  4. 4. AWS Lambda: Serverless computing Run code without servers. Pay only for the compute time you consume. Be happy. Triggered by events or called from APIs: • PUT to an Amazon S3 bucket • Updates to Amazon DynamoDB table • Call to an Amazon API Gateway endpoint • Mobile app back-end call • Complex workflows with AWS Step Functions • CloudFront requests • And many more… Makes it easy to: • Perform real-time data processing • Build scalable back-end services • Glue and choreograph systems
  5. 5. Benefits of AWS Lambda Continuous scaling No servers to manage Never pay for idle – no cold servers (only happy accountants)
  6. 6. Amazon CloudFront
  7. 7. Amazon CloudFront Global Content Delivery Network North America Cities: 20, PoPs: 29 Ashburn, VA (3) Atlanta, GA (3) Bostong, MA Chicago, IL Dallas/Fort Worth, TX (2) Hayward, CA Jacksonville, FL Los Angeles, CA (2) Miami, FL Minneapolis, MN Montreal, QC Newark, NJ New York, NY (3) Palo Alto, CA Philadelphia, PA San Jose, CA Seattle, WA (3) South Bend, IN St. Louis, MO Toronto, ON Europe / Middle East / Africa Cities: 15, PoPs: 24 Amsterdam, The Netherlands (2) Berlin, Germany Dublin, Ireland Frankfurt, Germany (6) London, England (4) Madrid, Spain Marseille, France Milan, Italy Munich, Germany Paris, France (3) Prague, Czech Republic Stockholm, Sweden Vienna, Austria Warsaw, Poland Zurich, Switzerland 95 CloudFront locations, incl. 84 CloudFront Edge Locations (PoPs) & 11 Regional Edge Caches Edge Location Region Regional Edge Cache Asia Pacific Cities: 12, PoPs: 20 Chennai, India Hong Kong, China (3) Manila, the Philippines Melbourne, Australia Mumbai, India (2) New Delhi, India Osaka, Japan Seoul, Korea (3) Singapore (2) Sydney, Australia Taipei, Taiwan Tokyo, Japan (4) Regional Edge Caches Regions: 11 Oregon N. Virginia Frankfurt London Sao Paulo Mumbai Singapore Seoul Tokyo Sydney South America Cities: 2, PoPs: 3 Rio de Janeiro, Brazil (2) São Paulo, Brazil
  8. 8. CloudFront Key Features Accelerate static and dynamic content (websites, APIs) Scalable and Global Cache content closer to the user Support HTTP/2 and IPv6 Highly secure PCI DSS Level 1, ISO & HIPAA compliant TLS (including HTTPS-only) Amazon Certificate Manager AWS Shield AWS WAF Self-service (Console, CLI, API, SDKs, CloudFormation) Cost-efficient
  9. 9. Your Application = EC2, ELB, S3 Route 53, CloudFront, AWS WAF & Shield HTML5, Mobile, Desktop Origin+ Edge+ Client …and Lambda@Edge!
  10. 10. AWS Lambda@Edge
  11. 11. Introducing Lambda@Edge Lambda@Edge is an extension of AWS Lambda that allows you to run Node.js code at AWS global edge locations. Bring your own code to the edge and customize your content very close to your users, improving end user experience. No servers to manage Continuous scaling Never pay for idle – no cold servers Globally distributed
  12. 12. Write once, run everywhere
  13. 13. CloudFront Triggers for Lambda@Edge
  14. 14. CloudFront Triggers for Lambda@Edge
  15. 15. CloudFront Triggers for Lambda@Edge
  16. 16. What Can Lambda@Edge Do? Add/Remove/Modify request and response headers Modify request URL path Generate response Access request info from response
  17. 17. Lambda compared to Lambda@Edge Lambda Lambda@Edge Languages Node.js, Python, C#, Java Node.js Memory 128->1536MB 128MB Execution time <300 seconds <3 seconds (Origin-facing) <1 seconds (Viewer-facing) Deployment size <50MB <1MB Request pricing First 1 million free $0.20 per 1 million $0.60 per 1 million Duration granularity 100ms 50ms 128MB for 100ms $0.000000208 $0.000000625
  18. 18. Use cases
  19. 19. Usecases – Response generation Multiple origins Personalisation (e.g. ‘Lee’s Account’ in the top-left) Results of multiple API calls Content-type transformation (e.g. XML->JSON)
  20. 20. Usecases – HTTP Redirects Cool URIs don’t change (…though they may redirect) Redirect to latest version Redirect example.com -> www.example.com
  21. 21. Usecases – URL Rewriting Semantic (pretty) URLs /foo-cms/view/42.asp -> /articles/42 Adaptive content Client capabilities – Accept-Type header, screen size Image cropping/resizing
  22. 22. Usecases – Security Best Practices Add security response headers: • Strict-Transport-Security • Content-Security-Policy • X-Content-Type-Options • X-Frame-Options • X-XSS-Protection • Referrer-Policy • Public-Key-Pins Remove informational response headers: • Server • Powered-By
  23. 23. Usecases –Authorization Bot handling – using CAPTCHA Non-standard authorization (not HTTP Basic/Digest/etc) Origin doesn’t implement authorization Pay-per-view / Paywall application
  24. 24. Usecases – A/B Testing Test your theory on a proportion of users Measure valuable metric (social likes/shares, engagement, purchases, etc) Implement findings
  25. 25. Demo Time!
  26. 26. Summary
  27. 27. Lambda@Edge Summary Features: Header manipulation URL rewrites Response generation Benefits: Bring your own code Familiar programming model Write once, run everywhere
  28. 28. Thank you! Lee Atkinson, Solutions Architect

×