SlideShare a Scribd company logo
1 of 52
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS re:INVENT
Building Serverless Websites with Lambda@Edge
G e o r g e J o h n
P r o d u c t M a n a g e r
A m a z o n C l o u d F r o n t / L a m b d a @ E d g e
M a n i g a n d a n R a d h a k r i s h n a n
S e n i o r S o f t w a r e D e v e l o p m e n t E n g i n e e r
A m a z o n C l o u d F r o n t / L a m b d a @ E d g e
C T D 3 0 9
D e c e m b e r 1 , 2 0 1 7
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What Is Covered in This Session
• Why run websites at the edge?
• What is Lambda@Edge?
• How can Lambda@Edge help?
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
In the Beginning …
• You have a breakthrough idea
• You decide to build a MVP
• You choose AWS as your platform
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Your News Aggregator
Dynamic Personalized
Content
(user preference)
Authentication
Dynamic Content
(News feed)
Static Content
(images,JS,CSS, …)
Dynamic Customized
Content
(viewer location)
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Architecture (Simple, But Works)
Compute
viewer
StorageDatastore
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Architecture (Simple, But Works)
Origin
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Then You Hit the Growth Phase
Time
Growth
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
And Now …
Origin
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
New Challenges
• Need to scale to the increased demand
• Scale infrastructure
• Manage operational complexity
• And, still provide good user experience
• Faster page load times
• Rich set of features
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon CloudFront AWS Lambda
Lambda@Edge
Lambda@Edge
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon CloudFront
Content Delivery Network
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon CloudFront Global Content Delivery Network
107 PoPs (96 Edge Locations + 11 Regional Edge Caches)
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon CloudFront
Origin
AWS Location
AWS Location
AWS Location
AWS Location
AWS Location
AWS Location
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Dynamic Content
(News feed)Static Content
(images,JS,CSS, …)
C o n t e n t A c c e l e r a t io n w it h C l o u d F r o n t
Dynamic Customized
Content
(viewer location)
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Lambda
Serverless Compute
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
No servers to provision
or manage
Scales with usage
Never pay for idle Built-in availability
and fault tolerance
AWS Lambda
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lambda@Edge
Globally
distributed
No servers to provision
or manage
Scales with usage Never pay for idle Built-in availability
and fault tolerance
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Write Once, Run Lambda Functions Globally
N Virginia
AWS Location
AWS Location
AWS Location
AWS Location
AWS Location
AWS Location
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lambda@Edge – Deep Dive
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lambda@Edge Events
CloudFront
cache
Viewer Response Origin Response
Origin
Origin Request
Viewer
Viewer Request
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lambda@Edge Programming Model
Event Driven
• Functions are associated with events
• viewer-request -> my_function:1
• Functions are invoked when these events happen
• viewer-request is run when CloudFront receives a request
• Functions are invoked with the details of the event as input
• my_function:1 is invoked with the request object
• Functions can return results back to the caller
• callback(request)
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
exports.handler = (event, context, callback) => {
/* viewer-request and origin-request events
* have the request as input */
const request = event.Records[0].cf.request;
/* viewer-response and origin-response events
* have the response as input */
/* const response = event.Records[0].cf.response; */
/* Do the processing – say add a header */
/* When I am done I let CloudFront what to do next */
callback(null, request);
}
Lambda@Edge Programming Model
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Dynamic Customized
Content
(viewer location)
Customization with Lambda@Edge
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Customization - Inputs
Non-personal artifacts (customization) – Request attributes
• Geography
• Local weather, traffic updates, local/regional news, local events, and so on
• Device Type
• Mobile vs. Desktop
• QHD phone vs. 720p phone
• User Agent
• Crawler vs. Actual user
• Referer
Personalization
• User’s identity + Information related to that user
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Customizations - Setup
With origin
• Using CloudFront cache - URL,
Header, and Query parameters
• Using origin selection
Serverless
• Using CloudFront cache - URL,
Header, and Query parameters
• Generating content at the edge
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Customization - Examples
URL modification
• Serve different content based on viewer’s country
• E.g.: “/index.html” -> “/au/index.html” or “/uk/index.html” or “/de/index.html”)
• Serve different web assets from same distribution
• E.g.: Use Host header to rewrite URL.
• “/index.html” + “Host: foo.com”-> URL: “/foo_com/index.html”
• “/index.html” + “Host: bar.com” -> URL: “/bar_com/index.html”
• Serve different content by device type
• E.g.: Use CloudFront-Is-Mobile-Viewer -> URL: “/mobile/index.html” or
“/desktop/index.html”
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Customization - Examples
Header Add/Modify/Delete
• Security Headers
• Ex: Insert HSTS, CORS headers for all responses
• Setting Cache-control headers for S3 objects
• Ex: Be able to do it for a larger group at once
• /images/* or /*.jpg
• Expose the true Client IP to the origin
• Ex: copy X-Forwarded-For to a header (True-Client-IP) that the origin understands
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Example – Customize Based on Device Type
All clients request https://example.com/index.html
• CloudFront-Is-Mobile-Viewer: true -> https://example.com/mobile/index.html
• Every one else is unchanged or gets sent to https://example.com/desktop/index.html
• Content is highly cachable – so run logic in origin-request event
• To correctly cache the content add CloudFront-Is-Mobile-Viewer to Forward headers
CloudF
ront
cache
Origin
Origin
Request
Viewer
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
exports.handler = (event, context, callback) => {
const request = event.Records[0].cf.request;
const headers = request.headers;
/* Direct to a different part of the website based on
* the device type */
const desktopPath = '/dektop’;
Const mobilePath = '/mobile';
if (headers['cloudfront-is-desktop-viewer'] && headers['cloudfront-is-desktop-viewer'][0].value === 'true’) {
request.uri = desktopPath + request.uri;
} else if (headers['cloudfront-is-mobile-viewer'] && headers['cloudfront-is-mobile-viewer'][0].value === 'true') {
request.uri = mobilePath + request.uri;
}
console.log(`Request uri set to "${request.uri}"`);
callback(null, request);
}
Example – Customize Based on Device Type
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Customization Using Origin Selection
• Multiple origin setup
• Latency: Talk to the origin closest to the viewer
• Load balance across origins
• Controlled rollout of changes at origin
• A/B Testing of new features
• Blue/Green origin deploys
• Migrating between origins
• Including on-premise to cloud
• Search Engine Optimization
• Serve human and web crawler traffic from separate origins
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Origin Selection – A/B Testing
Example: You want to test a new feature. It is only deployed to one of your origins
In the function:
1. Check to see if this is a active session. (Say, using a cookie.)
2. For active sessions, set the origin based on the value in the cookie
3. For a new session, decide whether to show A or B variant. And set the origin accordingly
CloudFront
cache
Origin
Request
Viewer
Origin B
Origin A
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
"s3": {
"domainName": "green-bucket.s3.amazonaws.com”,
"path": "/originPath",
"authMethod": "origin-access-identity",
"region": "us-east-1",
"customHeaders": {
"my-custom-origin-header": [
{
"key": "My-Custom-Origin-Header",
"value": "test-value”
}
]
}
}
Origin Selection
• Origin is present as part of request
• event.Records[0].cf.request.origin
• Modified Origin should also be part of the request
structure returned
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
exports.handler = (event, context, callback) => {
const request = event.Records[0].cf.request;
desiredOrigin = decide(request);
/* Set custom origin fields*/
request.origin = {
custom: {
domainName: desiredOrigin,
port: 443,
protocol: 'https',
}
};
request.headers['host'] = [{ key: 'host',
value: desiredOrigin }];
callback(null, request);
};
Example – A/B Testing
function decide(request) {
if (request.headers[‘my-session-cookie’]) {
cookie = request.headers[‘my-session-
cookie’].value;
return decodeOrigin(cookie);
} else {
return chooseOrigin(request);
}
};
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Response Generation
• Generate response at the edge
• Return response from viewer-request or origin-request event
• Requests are served completely from the Lambda@Edge function. Request never reaches origin.
CloudFront
cache
Viewer Request
Origin
Origin Request
Viewer
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Response Generation
• Response generated at the edge location
• Can be done in viewer-request or origin-request events
• Generate a complete HTTP response in the function
• Return this response as part of callback
Callback(null, response);
• Request never reaches out to the origin
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Customization Using Response Generation
• Without body (only headers)
• Redirect
• May use external source for decision making
• With body
• Constituent elements are highly cacheable
• Generated response may be unique to the viewer
• Using input from the request
• Ex: Weather App – landing page
– List of cities varies by user. Request has list of cities.
– Each city’s weather is highly cacheable
• Using user-specific data (not part of the request)
• Ex: My Prime Music page
– Shows list of albums I own
– Recommended playlists
– Input often comes from a datastore
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Example - Redirect
• Viewer-request event and Origin-request event
• Redirect to a login page for non-authenticated users
• In viewer-request function validate the cookie
• If cookie is expired or not present, redirect to login page
CloudFront
cache
Viewer Request
Origin
Origin Request
Viewer
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
'use strict';
exports.handler = (event, context, callback) => {
/*
* Generate HTTP redirect response with 302 status code and Location header.
*/
const response = {
status: '302',
statusDescription: 'Found',
headers: {
location: [{
key: 'Location',
value: 'http://mydomain.com/login.html',
}],
},
};
callback(null, response);
};
Example - Redirect
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Example - Content Aggregation
Example: Weather App Landing page
Client: Each user has a set of cities.
http://example.com/weather?cities=Seattle;NYC
Function:
• Parses the URL
• Fetches the relevant data
• Sends the aggregated response to the client (app)
CloudFront
cache
Viewer
Request
Origin
Request
Viewer
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
function getCityForecast(request) {
return new Promise((resolve, reject) => {
https.get(request.uri, (response) => {
let content = '';
response.setEncoding('utf8');
response.on('data', (chunk) => { content += chunk; });
response.on('end', () => resolve({ city: request.city, forecast: content }));
}).on('error', e => reject(e));
});
}
const uriSplit = uri.split('/');
const cities = uriSplit[2].split(':');
const forecasts = [];
cities.forEach((cityName) => {
const cityForecastUri = citiesBaseUri + cityName;
forecasts.push({ city: cityName, uri: cityForecastUri })
});
Example - Content Aggregation
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Promise.all(forecasts.map(getCityForecast)).then((ret) => {
console.log('Aggregating the responses:n', ret);
const response = {
status: '200', /* Status signals this is a generated response */
statusDescription: 'OK',
headers: {
'content-type': [{
key: 'Content-Type',
value: 'application/json',
}],
'content-encoding': [{
key: 'Content-Encoding',
value: 'UTF-8',
}],
},
body: JSON.stringify(ret, null, 't'),
};
console.log('Generated response: ', JSON.stringify(response));
callback(null, response);
Example - Content Aggregation
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What Else Can You Move to the Edge?
Dynamic Customized
Content
(viewer location)
Dynamic Personalized
Content
(user preference)
Authentication
Dynamic Content
(News feed)Static Content
(images,JS,CSS, …)
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
CloudFront + Lambda@Edge
Origin
AWS Location
AWS Location
AWS Location
AWS Location
AWS Location
AWS Location
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Personalization
• Identity: Authentication – know who the customer is
• Information: knowledge about the customer
• Preferences, Browsing/buying history …
• Combine Identity and Information to create content personalized
to that user
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Authentication
A mechanism to decide whether to serve this request or not:
• Authentication using Trusted Signers (CloudFront feature)
• Authentication - validated at the edge in the function
• Authentication using remote servers
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Accessing Data from Functions
• Bundle with the code
• Easy to use/access. Fast
• Read only. Limited by size of deployment package. Change requires a deploy.
• CloudFront cache
• Close to the function (often in the same location). Periodically refreshed (TTL).
• Read only
• AWS DB offering (DDB, Aurora)
• Read-write
• Often in one region farther away from the function
• Amazon DynamoDB Global Tables
• Multi-Region, Multi-Master tables
• Read-write, closer to functions
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Content Generation - Personalization
Example: We want to recommend new “items” when a user logs in
Client:
• https://example.com/index.html
• User is logged in
Function:
• Fetch user’s history and preference from DDB
• Generate response using the fetched data as input
• Ex:
• News articles based on my reading history
• Music or Movie recommendations based on my listening/watching
• Recommendations based on people you follow
CloudFront
cache
Viewer
Request
Origin
Request
Viewer
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
/* Access DDB */
var aws = require('aws-sdk');
var ddb = new aws.DynamoDB().DocumentClient({apiVersion: '2012-10-08', region: 'us-east-1'});;
/* Get the item based on the user */
function getItems(request, context, callback) {
const params = {
TableName: ”recommendations",
Key: { ”User": { "S": user } }
};
ddb.getItem(params, function(err, data) {
if (err) {
console.log(err, err.stack);
generateErrorResponse(request, callback);
} else {
console.log("Received output from ddb: " + data)
generateResponse(request, data, callback);
}
});
}
Content Generation - Recommendations
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Serverless at the Edge
Dynamic Customized
Content
(viewer location)
Dynamic Personalized
Content
(user preference)
Authentication
Dynamic Content
(News feed)Static Content
(images,JS,CSS, …)
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Demo
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Serverless at the Edge
Origin
AWS Location
AWS Location
AWS Location
AWS Location
AWS Location
AWS Location
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Thank you!

More Related Content

What's hot

Build your case for the cloud and engage your business stakeholders
Build your case for the cloud and engage your business stakeholdersBuild your case for the cloud and engage your business stakeholders
Build your case for the cloud and engage your business stakeholdersAmazon Web Services
 
CMP323_AWS Batch Easy & Efficient Batch Computing on Amazon Web Services
CMP323_AWS Batch Easy & Efficient Batch Computing on Amazon Web ServicesCMP323_AWS Batch Easy & Efficient Batch Computing on Amazon Web Services
CMP323_AWS Batch Easy & Efficient Batch Computing on Amazon Web ServicesAmazon Web Services
 
SID302_Force Multiply Your Security Team with Automation and Alexa
SID302_Force Multiply Your Security Team with Automation and AlexaSID302_Force Multiply Your Security Team with Automation and Alexa
SID302_Force Multiply Your Security Team with Automation and AlexaAmazon Web Services
 
Getting from Here to There: A Journey from On-premises to Serverless Architec...
Getting from Here to There: A Journey from On-premises to Serverless Architec...Getting from Here to There: A Journey from On-premises to Serverless Architec...
Getting from Here to There: A Journey from On-premises to Serverless Architec...Amazon Web Services
 
Building a Photorealistic Real-Time 3D Configurator with Server-Side Renderin...
Building a Photorealistic Real-Time 3D Configurator with Server-Side Renderin...Building a Photorealistic Real-Time 3D Configurator with Server-Side Renderin...
Building a Photorealistic Real-Time 3D Configurator with Server-Side Renderin...Amazon Web Services
 
Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017
Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017
Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017Amazon Web Services
 
An Introduction to AI Services on AWS - Web Summit Lisbon
An Introduction to AI Services on AWS -  Web Summit LisbonAn Introduction to AI Services on AWS -  Web Summit Lisbon
An Introduction to AI Services on AWS - Web Summit LisbonBoaz Ziniman
 
規劃大規模遷移到 AWS 的最佳實踐
規劃大規模遷移到 AWS 的最佳實踐規劃大規模遷移到 AWS 的最佳實踐
規劃大規模遷移到 AWS 的最佳實踐Amazon Web Services
 
Digital Transformation: Adapt or Perish - CON207 - re:Invent 2017
Digital Transformation: Adapt or Perish - CON207 - re:Invent 2017Digital Transformation: Adapt or Perish - CON207 - re:Invent 2017
Digital Transformation: Adapt or Perish - CON207 - re:Invent 2017Amazon Web Services
 
Serverless DevOps to the Rescue - SRV330 - re:Invent 2017
Serverless DevOps to the Rescue - SRV330 - re:Invent 2017Serverless DevOps to the Rescue - SRV330 - re:Invent 2017
Serverless DevOps to the Rescue - SRV330 - re:Invent 2017Amazon Web Services
 
CON203_Driving Innovation with Containers
CON203_Driving Innovation with ContainersCON203_Driving Innovation with Containers
CON203_Driving Innovation with ContainersAmazon Web Services
 
GPSTEC319-Build Once Deploy Many Architecting and Building Automated Reusable...
GPSTEC319-Build Once Deploy Many Architecting and Building Automated Reusable...GPSTEC319-Build Once Deploy Many Architecting and Building Automated Reusable...
GPSTEC319-Build Once Deploy Many Architecting and Building Automated Reusable...Amazon Web Services
 
GPSTEC306-Continuous Compliance for Healthcare and Life Sciences
GPSTEC306-Continuous Compliance for Healthcare and Life SciencesGPSTEC306-Continuous Compliance for Healthcare and Life Sciences
GPSTEC306-Continuous Compliance for Healthcare and Life SciencesAmazon Web Services
 
ARC201_Scaling Up to Your First 10 Million Users
ARC201_Scaling Up to Your First 10 Million UsersARC201_Scaling Up to Your First 10 Million Users
ARC201_Scaling Up to Your First 10 Million UsersAmazon Web Services
 
ATC301-Big Data & Analytics for Manufacturing Operations
ATC301-Big Data & Analytics for Manufacturing OperationsATC301-Big Data & Analytics for Manufacturing Operations
ATC301-Big Data & Analytics for Manufacturing OperationsAmazon Web Services
 
GPSWKS406-Migrating a Microsoft ASP.NET Application to AWS
GPSWKS406-Migrating a Microsoft ASP.NET Application to AWSGPSWKS406-Migrating a Microsoft ASP.NET Application to AWS
GPSWKS406-Migrating a Microsoft ASP.NET Application to AWSAmazon Web Services
 
CON320_Monitoring, Logging and Debugging Containerized Services
CON320_Monitoring, Logging and Debugging Containerized ServicesCON320_Monitoring, Logging and Debugging Containerized Services
CON320_Monitoring, Logging and Debugging Containerized ServicesAmazon Web Services
 
DEV203_Launch Applications the Amazon Way
DEV203_Launch Applications the Amazon WayDEV203_Launch Applications the Amazon Way
DEV203_Launch Applications the Amazon WayAmazon Web Services
 
MBL209_Learn How MicroStrategy on AWS is Helping Vivint Solar Deliver Clean E...
MBL209_Learn How MicroStrategy on AWS is Helping Vivint Solar Deliver Clean E...MBL209_Learn How MicroStrategy on AWS is Helping Vivint Solar Deliver Clean E...
MBL209_Learn How MicroStrategy on AWS is Helping Vivint Solar Deliver Clean E...Amazon Web Services
 

What's hot (20)

Build your case for the cloud and engage your business stakeholders
Build your case for the cloud and engage your business stakeholdersBuild your case for the cloud and engage your business stakeholders
Build your case for the cloud and engage your business stakeholders
 
DVC202_The Open Guide to AWS
DVC202_The Open Guide to AWSDVC202_The Open Guide to AWS
DVC202_The Open Guide to AWS
 
CMP323_AWS Batch Easy & Efficient Batch Computing on Amazon Web Services
CMP323_AWS Batch Easy & Efficient Batch Computing on Amazon Web ServicesCMP323_AWS Batch Easy & Efficient Batch Computing on Amazon Web Services
CMP323_AWS Batch Easy & Efficient Batch Computing on Amazon Web Services
 
SID302_Force Multiply Your Security Team with Automation and Alexa
SID302_Force Multiply Your Security Team with Automation and AlexaSID302_Force Multiply Your Security Team with Automation and Alexa
SID302_Force Multiply Your Security Team with Automation and Alexa
 
Getting from Here to There: A Journey from On-premises to Serverless Architec...
Getting from Here to There: A Journey from On-premises to Serverless Architec...Getting from Here to There: A Journey from On-premises to Serverless Architec...
Getting from Here to There: A Journey from On-premises to Serverless Architec...
 
Building a Photorealistic Real-Time 3D Configurator with Server-Side Renderin...
Building a Photorealistic Real-Time 3D Configurator with Server-Side Renderin...Building a Photorealistic Real-Time 3D Configurator with Server-Side Renderin...
Building a Photorealistic Real-Time 3D Configurator with Server-Side Renderin...
 
Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017
Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017
Create a Serverless Image Processing Platform - ARC326 - re:Invent 2017
 
An Introduction to AI Services on AWS - Web Summit Lisbon
An Introduction to AI Services on AWS -  Web Summit LisbonAn Introduction to AI Services on AWS -  Web Summit Lisbon
An Introduction to AI Services on AWS - Web Summit Lisbon
 
規劃大規模遷移到 AWS 的最佳實踐
規劃大規模遷移到 AWS 的最佳實踐規劃大規模遷移到 AWS 的最佳實踐
規劃大規模遷移到 AWS 的最佳實踐
 
Digital Transformation: Adapt or Perish - CON207 - re:Invent 2017
Digital Transformation: Adapt or Perish - CON207 - re:Invent 2017Digital Transformation: Adapt or Perish - CON207 - re:Invent 2017
Digital Transformation: Adapt or Perish - CON207 - re:Invent 2017
 
Serverless DevOps to the Rescue - SRV330 - re:Invent 2017
Serverless DevOps to the Rescue - SRV330 - re:Invent 2017Serverless DevOps to the Rescue - SRV330 - re:Invent 2017
Serverless DevOps to the Rescue - SRV330 - re:Invent 2017
 
CON203_Driving Innovation with Containers
CON203_Driving Innovation with ContainersCON203_Driving Innovation with Containers
CON203_Driving Innovation with Containers
 
GPSTEC319-Build Once Deploy Many Architecting and Building Automated Reusable...
GPSTEC319-Build Once Deploy Many Architecting and Building Automated Reusable...GPSTEC319-Build Once Deploy Many Architecting and Building Automated Reusable...
GPSTEC319-Build Once Deploy Many Architecting and Building Automated Reusable...
 
GPSTEC306-Continuous Compliance for Healthcare and Life Sciences
GPSTEC306-Continuous Compliance for Healthcare and Life SciencesGPSTEC306-Continuous Compliance for Healthcare and Life Sciences
GPSTEC306-Continuous Compliance for Healthcare and Life Sciences
 
ARC201_Scaling Up to Your First 10 Million Users
ARC201_Scaling Up to Your First 10 Million UsersARC201_Scaling Up to Your First 10 Million Users
ARC201_Scaling Up to Your First 10 Million Users
 
ATC301-Big Data & Analytics for Manufacturing Operations
ATC301-Big Data & Analytics for Manufacturing OperationsATC301-Big Data & Analytics for Manufacturing Operations
ATC301-Big Data & Analytics for Manufacturing Operations
 
GPSWKS406-Migrating a Microsoft ASP.NET Application to AWS
GPSWKS406-Migrating a Microsoft ASP.NET Application to AWSGPSWKS406-Migrating a Microsoft ASP.NET Application to AWS
GPSWKS406-Migrating a Microsoft ASP.NET Application to AWS
 
CON320_Monitoring, Logging and Debugging Containerized Services
CON320_Monitoring, Logging and Debugging Containerized ServicesCON320_Monitoring, Logging and Debugging Containerized Services
CON320_Monitoring, Logging and Debugging Containerized Services
 
DEV203_Launch Applications the Amazon Way
DEV203_Launch Applications the Amazon WayDEV203_Launch Applications the Amazon Way
DEV203_Launch Applications the Amazon Way
 
MBL209_Learn How MicroStrategy on AWS is Helping Vivint Solar Deliver Clean E...
MBL209_Learn How MicroStrategy on AWS is Helping Vivint Solar Deliver Clean E...MBL209_Learn How MicroStrategy on AWS is Helping Vivint Solar Deliver Clean E...
MBL209_Learn How MicroStrategy on AWS is Helping Vivint Solar Deliver Clean E...
 

Similar to Building Serverless Websites with Lambda@Edge - CTD309 - re:Invent 2017

SRV312_Taking Serverless to the Edge
SRV312_Taking Serverless to the EdgeSRV312_Taking Serverless to the Edge
SRV312_Taking Serverless to the EdgeAmazon Web Services
 
Journey Towards Scaling Your API to 10 Million Users
Journey Towards Scaling Your API to 10 Million UsersJourney Towards Scaling Your API to 10 Million Users
Journey Towards Scaling Your API to 10 Million UsersAdrian Hornsby
 
Learn how to build serverless applications using the AWS Serverless Platform-...
Learn how to build serverless applications using the AWS Serverless Platform-...Learn how to build serverless applications using the AWS Serverless Platform-...
Learn how to build serverless applications using the AWS Serverless Platform-...Amazon Web Services
 
Serverless in Action on AWS
Serverless in Action on AWSServerless in Action on AWS
Serverless in Action on AWSAdrian Hornsby
 
AWS X-Ray: Debugging Applications at Scale - AWS Online Tech Talks
AWS X-Ray: Debugging Applications at Scale - AWS Online Tech TalksAWS X-Ray: Debugging Applications at Scale - AWS Online Tech Talks
AWS X-Ray: Debugging Applications at Scale - AWS Online Tech TalksAmazon Web Services
 
Introduction to Amazon CloudFront and AWS Lambda@Edge - CTD201 - re:Invent 2017
Introduction to Amazon CloudFront and AWS Lambda@Edge - CTD201 - re:Invent 2017Introduction to Amazon CloudFront and AWS Lambda@Edge - CTD201 - re:Invent 2017
Introduction to Amazon CloudFront and AWS Lambda@Edge - CTD201 - re:Invent 2017Amazon Web Services
 
CTD201_Introduction to Amazon CloudFront and AWS Lambda@Edge
CTD201_Introduction to Amazon CloudFront and AWS Lambda@EdgeCTD201_Introduction to Amazon CloudFront and AWS Lambda@Edge
CTD201_Introduction to Amazon CloudFront and AWS Lambda@EdgeAmazon Web Services
 
I Want to Analyze and Visualize Website Access Logs, but Why Do I Need Server...
I Want to Analyze and Visualize Website Access Logs, but Why Do I Need Server...I Want to Analyze and Visualize Website Access Logs, but Why Do I Need Server...
I Want to Analyze and Visualize Website Access Logs, but Why Do I Need Server...Amazon Web Services
 
Case Study: The internals of Amazon.com's architecture that allows it to secu...
Case Study: The internals of Amazon.com's architecture that allows it to secu...Case Study: The internals of Amazon.com's architecture that allows it to secu...
Case Study: The internals of Amazon.com's architecture that allows it to secu...Amazon Web Services
 
SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...
SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...
SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...Amazon Web Services
 
Introduction to Serverless Computing and AWS Lambda - AWS IL Meetup
Introduction to Serverless Computing and AWS Lambda - AWS IL MeetupIntroduction to Serverless Computing and AWS Lambda - AWS IL Meetup
Introduction to Serverless Computing and AWS Lambda - AWS IL MeetupBoaz Ziniman
 
Building Serverless Websites with Lambda@Edge - AWS Online Tech Talks
Building Serverless Websites with Lambda@Edge - AWS Online Tech TalksBuilding Serverless Websites with Lambda@Edge - AWS Online Tech Talks
Building Serverless Websites with Lambda@Edge - AWS Online Tech TalksAmazon Web Services
 
Reactive Architectures with Microservices
Reactive Architectures with MicroservicesReactive Architectures with Microservices
Reactive Architectures with MicroservicesAWS Germany
 
Ionic and React Hybrid Web/Native Mobile Applications with Mobile Hub - AWS O...
Ionic and React Hybrid Web/Native Mobile Applications with Mobile Hub - AWS O...Ionic and React Hybrid Web/Native Mobile Applications with Mobile Hub - AWS O...
Ionic and React Hybrid Web/Native Mobile Applications with Mobile Hub - AWS O...Amazon Web Services
 
Scale Website dan Mobile Applications Anda di AWS hingga 10 juta pengguna
Scale Website dan Mobile Applications Anda di AWS hingga 10 juta penggunaScale Website dan Mobile Applications Anda di AWS hingga 10 juta pengguna
Scale Website dan Mobile Applications Anda di AWS hingga 10 juta penggunaAmazon Web Services
 
SRV313_Building Resilient, Multi-Region Serverless Applications
SRV313_Building Resilient, Multi-Region Serverless ApplicationsSRV313_Building Resilient, Multi-Region Serverless Applications
SRV313_Building Resilient, Multi-Region Serverless ApplicationsAmazon Web Services
 
End-User Computing on AWS with Amazon WorkSpaces and Amazon AppStream 2.0 - E...
End-User Computing on AWS with Amazon WorkSpaces and Amazon AppStream 2.0 - E...End-User Computing on AWS with Amazon WorkSpaces and Amazon AppStream 2.0 - E...
End-User Computing on AWS with Amazon WorkSpaces and Amazon AppStream 2.0 - E...Amazon Web Services
 
Building .NET-based Serverless Architectures and Running .NET Core Microservi...
Building .NET-based Serverless Architectures and Running .NET Core Microservi...Building .NET-based Serverless Architectures and Running .NET Core Microservi...
Building .NET-based Serverless Architectures and Running .NET Core Microservi...Amazon Web Services
 
Intro To AWS for Mobile Developers: Collision 2018
Intro To AWS for Mobile Developers: Collision 2018Intro To AWS for Mobile Developers: Collision 2018
Intro To AWS for Mobile Developers: Collision 2018Amazon Web Services
 

Similar to Building Serverless Websites with Lambda@Edge - CTD309 - re:Invent 2017 (20)

SRV312_Taking Serverless to the Edge
SRV312_Taking Serverless to the EdgeSRV312_Taking Serverless to the Edge
SRV312_Taking Serverless to the Edge
 
Journey Towards Scaling Your API to 10 Million Users
Journey Towards Scaling Your API to 10 Million UsersJourney Towards Scaling Your API to 10 Million Users
Journey Towards Scaling Your API to 10 Million Users
 
Learn how to build serverless applications using the AWS Serverless Platform-...
Learn how to build serverless applications using the AWS Serverless Platform-...Learn how to build serverless applications using the AWS Serverless Platform-...
Learn how to build serverless applications using the AWS Serverless Platform-...
 
Serverless in Action on AWS
Serverless in Action on AWSServerless in Action on AWS
Serverless in Action on AWS
 
AWS X-Ray: Debugging Applications at Scale - AWS Online Tech Talks
AWS X-Ray: Debugging Applications at Scale - AWS Online Tech TalksAWS X-Ray: Debugging Applications at Scale - AWS Online Tech Talks
AWS X-Ray: Debugging Applications at Scale - AWS Online Tech Talks
 
Introduction to Amazon CloudFront and AWS Lambda@Edge - CTD201 - re:Invent 2017
Introduction to Amazon CloudFront and AWS Lambda@Edge - CTD201 - re:Invent 2017Introduction to Amazon CloudFront and AWS Lambda@Edge - CTD201 - re:Invent 2017
Introduction to Amazon CloudFront and AWS Lambda@Edge - CTD201 - re:Invent 2017
 
CTD201_Introduction to Amazon CloudFront and AWS Lambda@Edge
CTD201_Introduction to Amazon CloudFront and AWS Lambda@EdgeCTD201_Introduction to Amazon CloudFront and AWS Lambda@Edge
CTD201_Introduction to Amazon CloudFront and AWS Lambda@Edge
 
I Want to Analyze and Visualize Website Access Logs, but Why Do I Need Server...
I Want to Analyze and Visualize Website Access Logs, but Why Do I Need Server...I Want to Analyze and Visualize Website Access Logs, but Why Do I Need Server...
I Want to Analyze and Visualize Website Access Logs, but Why Do I Need Server...
 
Case Study: The internals of Amazon.com's architecture that allows it to secu...
Case Study: The internals of Amazon.com's architecture that allows it to secu...Case Study: The internals of Amazon.com's architecture that allows it to secu...
Case Study: The internals of Amazon.com's architecture that allows it to secu...
 
SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...
SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...
SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...
 
Introduction to Serverless Computing and AWS Lambda - AWS IL Meetup
Introduction to Serverless Computing and AWS Lambda - AWS IL MeetupIntroduction to Serverless Computing and AWS Lambda - AWS IL Meetup
Introduction to Serverless Computing and AWS Lambda - AWS IL Meetup
 
Building Serverless Websites with Lambda@Edge - AWS Online Tech Talks
Building Serverless Websites with Lambda@Edge - AWS Online Tech TalksBuilding Serverless Websites with Lambda@Edge - AWS Online Tech Talks
Building Serverless Websites with Lambda@Edge - AWS Online Tech Talks
 
React Native Workshop
React Native WorkshopReact Native Workshop
React Native Workshop
 
Reactive Architectures with Microservices
Reactive Architectures with MicroservicesReactive Architectures with Microservices
Reactive Architectures with Microservices
 
Ionic and React Hybrid Web/Native Mobile Applications with Mobile Hub - AWS O...
Ionic and React Hybrid Web/Native Mobile Applications with Mobile Hub - AWS O...Ionic and React Hybrid Web/Native Mobile Applications with Mobile Hub - AWS O...
Ionic and React Hybrid Web/Native Mobile Applications with Mobile Hub - AWS O...
 
Scale Website dan Mobile Applications Anda di AWS hingga 10 juta pengguna
Scale Website dan Mobile Applications Anda di AWS hingga 10 juta penggunaScale Website dan Mobile Applications Anda di AWS hingga 10 juta pengguna
Scale Website dan Mobile Applications Anda di AWS hingga 10 juta pengguna
 
SRV313_Building Resilient, Multi-Region Serverless Applications
SRV313_Building Resilient, Multi-Region Serverless ApplicationsSRV313_Building Resilient, Multi-Region Serverless Applications
SRV313_Building Resilient, Multi-Region Serverless Applications
 
End-User Computing on AWS with Amazon WorkSpaces and Amazon AppStream 2.0 - E...
End-User Computing on AWS with Amazon WorkSpaces and Amazon AppStream 2.0 - E...End-User Computing on AWS with Amazon WorkSpaces and Amazon AppStream 2.0 - E...
End-User Computing on AWS with Amazon WorkSpaces and Amazon AppStream 2.0 - E...
 
Building .NET-based Serverless Architectures and Running .NET Core Microservi...
Building .NET-based Serverless Architectures and Running .NET Core Microservi...Building .NET-based Serverless Architectures and Running .NET Core Microservi...
Building .NET-based Serverless Architectures and Running .NET Core Microservi...
 
Intro To AWS for Mobile Developers: Collision 2018
Intro To AWS for Mobile Developers: Collision 2018Intro To AWS for Mobile Developers: Collision 2018
Intro To AWS for Mobile Developers: Collision 2018
 

More from Amazon Web Services

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Amazon Web Services
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Amazon Web Services
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateAmazon Web Services
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSAmazon Web Services
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Amazon Web Services
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Amazon Web Services
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...Amazon Web Services
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsAmazon Web Services
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareAmazon Web Services
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSAmazon Web Services
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAmazon Web Services
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareAmazon Web Services
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWSAmazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckAmazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without serversAmazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...Amazon Web Services
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceAmazon Web Services
 

More from Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Building Serverless Websites with Lambda@Edge - CTD309 - re:Invent 2017

  • 1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS re:INVENT Building Serverless Websites with Lambda@Edge G e o r g e J o h n P r o d u c t M a n a g e r A m a z o n C l o u d F r o n t / L a m b d a @ E d g e M a n i g a n d a n R a d h a k r i s h n a n S e n i o r S o f t w a r e D e v e l o p m e n t E n g i n e e r A m a z o n C l o u d F r o n t / L a m b d a @ E d g e C T D 3 0 9 D e c e m b e r 1 , 2 0 1 7
  • 2. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What Is Covered in This Session • Why run websites at the edge? • What is Lambda@Edge? • How can Lambda@Edge help?
  • 3. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. In the Beginning … • You have a breakthrough idea • You decide to build a MVP • You choose AWS as your platform
  • 4. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Your News Aggregator Dynamic Personalized Content (user preference) Authentication Dynamic Content (News feed) Static Content (images,JS,CSS, …) Dynamic Customized Content (viewer location)
  • 5. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Architecture (Simple, But Works) Compute viewer StorageDatastore
  • 6. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Architecture (Simple, But Works) Origin
  • 7. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Then You Hit the Growth Phase Time Growth
  • 8. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. And Now … Origin
  • 9. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. New Challenges • Need to scale to the increased demand • Scale infrastructure • Manage operational complexity • And, still provide good user experience • Faster page load times • Rich set of features
  • 10. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon CloudFront AWS Lambda Lambda@Edge Lambda@Edge
  • 11. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon CloudFront Content Delivery Network
  • 12. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon CloudFront Global Content Delivery Network 107 PoPs (96 Edge Locations + 11 Regional Edge Caches)
  • 13. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon CloudFront Origin AWS Location AWS Location AWS Location AWS Location AWS Location AWS Location
  • 14. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Dynamic Content (News feed)Static Content (images,JS,CSS, …) C o n t e n t A c c e l e r a t io n w it h C l o u d F r o n t Dynamic Customized Content (viewer location)
  • 15. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Lambda Serverless Compute
  • 16. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. No servers to provision or manage Scales with usage Never pay for idle Built-in availability and fault tolerance AWS Lambda
  • 17. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Lambda@Edge Globally distributed No servers to provision or manage Scales with usage Never pay for idle Built-in availability and fault tolerance
  • 18. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Write Once, Run Lambda Functions Globally N Virginia AWS Location AWS Location AWS Location AWS Location AWS Location AWS Location
  • 19. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Lambda@Edge – Deep Dive
  • 20. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Lambda@Edge Events CloudFront cache Viewer Response Origin Response Origin Origin Request Viewer Viewer Request
  • 21. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Lambda@Edge Programming Model Event Driven • Functions are associated with events • viewer-request -> my_function:1 • Functions are invoked when these events happen • viewer-request is run when CloudFront receives a request • Functions are invoked with the details of the event as input • my_function:1 is invoked with the request object • Functions can return results back to the caller • callback(request)
  • 22. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. exports.handler = (event, context, callback) => { /* viewer-request and origin-request events * have the request as input */ const request = event.Records[0].cf.request; /* viewer-response and origin-response events * have the response as input */ /* const response = event.Records[0].cf.response; */ /* Do the processing – say add a header */ /* When I am done I let CloudFront what to do next */ callback(null, request); } Lambda@Edge Programming Model
  • 23. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Dynamic Customized Content (viewer location) Customization with Lambda@Edge
  • 24. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Customization - Inputs Non-personal artifacts (customization) – Request attributes • Geography • Local weather, traffic updates, local/regional news, local events, and so on • Device Type • Mobile vs. Desktop • QHD phone vs. 720p phone • User Agent • Crawler vs. Actual user • Referer Personalization • User’s identity + Information related to that user
  • 25. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Customizations - Setup With origin • Using CloudFront cache - URL, Header, and Query parameters • Using origin selection Serverless • Using CloudFront cache - URL, Header, and Query parameters • Generating content at the edge
  • 26. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Customization - Examples URL modification • Serve different content based on viewer’s country • E.g.: “/index.html” -> “/au/index.html” or “/uk/index.html” or “/de/index.html”) • Serve different web assets from same distribution • E.g.: Use Host header to rewrite URL. • “/index.html” + “Host: foo.com”-> URL: “/foo_com/index.html” • “/index.html” + “Host: bar.com” -> URL: “/bar_com/index.html” • Serve different content by device type • E.g.: Use CloudFront-Is-Mobile-Viewer -> URL: “/mobile/index.html” or “/desktop/index.html”
  • 27. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Customization - Examples Header Add/Modify/Delete • Security Headers • Ex: Insert HSTS, CORS headers for all responses • Setting Cache-control headers for S3 objects • Ex: Be able to do it for a larger group at once • /images/* or /*.jpg • Expose the true Client IP to the origin • Ex: copy X-Forwarded-For to a header (True-Client-IP) that the origin understands
  • 28. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Example – Customize Based on Device Type All clients request https://example.com/index.html • CloudFront-Is-Mobile-Viewer: true -> https://example.com/mobile/index.html • Every one else is unchanged or gets sent to https://example.com/desktop/index.html • Content is highly cachable – so run logic in origin-request event • To correctly cache the content add CloudFront-Is-Mobile-Viewer to Forward headers CloudF ront cache Origin Origin Request Viewer
  • 29. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. exports.handler = (event, context, callback) => { const request = event.Records[0].cf.request; const headers = request.headers; /* Direct to a different part of the website based on * the device type */ const desktopPath = '/dektop’; Const mobilePath = '/mobile'; if (headers['cloudfront-is-desktop-viewer'] && headers['cloudfront-is-desktop-viewer'][0].value === 'true’) { request.uri = desktopPath + request.uri; } else if (headers['cloudfront-is-mobile-viewer'] && headers['cloudfront-is-mobile-viewer'][0].value === 'true') { request.uri = mobilePath + request.uri; } console.log(`Request uri set to "${request.uri}"`); callback(null, request); } Example – Customize Based on Device Type
  • 30. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Customization Using Origin Selection • Multiple origin setup • Latency: Talk to the origin closest to the viewer • Load balance across origins • Controlled rollout of changes at origin • A/B Testing of new features • Blue/Green origin deploys • Migrating between origins • Including on-premise to cloud • Search Engine Optimization • Serve human and web crawler traffic from separate origins
  • 31. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Origin Selection – A/B Testing Example: You want to test a new feature. It is only deployed to one of your origins In the function: 1. Check to see if this is a active session. (Say, using a cookie.) 2. For active sessions, set the origin based on the value in the cookie 3. For a new session, decide whether to show A or B variant. And set the origin accordingly CloudFront cache Origin Request Viewer Origin B Origin A
  • 32. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. "s3": { "domainName": "green-bucket.s3.amazonaws.com”, "path": "/originPath", "authMethod": "origin-access-identity", "region": "us-east-1", "customHeaders": { "my-custom-origin-header": [ { "key": "My-Custom-Origin-Header", "value": "test-value” } ] } } Origin Selection • Origin is present as part of request • event.Records[0].cf.request.origin • Modified Origin should also be part of the request structure returned
  • 33. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. exports.handler = (event, context, callback) => { const request = event.Records[0].cf.request; desiredOrigin = decide(request); /* Set custom origin fields*/ request.origin = { custom: { domainName: desiredOrigin, port: 443, protocol: 'https', } }; request.headers['host'] = [{ key: 'host', value: desiredOrigin }]; callback(null, request); }; Example – A/B Testing function decide(request) { if (request.headers[‘my-session-cookie’]) { cookie = request.headers[‘my-session- cookie’].value; return decodeOrigin(cookie); } else { return chooseOrigin(request); } };
  • 34. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Response Generation • Generate response at the edge • Return response from viewer-request or origin-request event • Requests are served completely from the Lambda@Edge function. Request never reaches origin. CloudFront cache Viewer Request Origin Origin Request Viewer
  • 35. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Response Generation • Response generated at the edge location • Can be done in viewer-request or origin-request events • Generate a complete HTTP response in the function • Return this response as part of callback Callback(null, response); • Request never reaches out to the origin
  • 36. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Customization Using Response Generation • Without body (only headers) • Redirect • May use external source for decision making • With body • Constituent elements are highly cacheable • Generated response may be unique to the viewer • Using input from the request • Ex: Weather App – landing page – List of cities varies by user. Request has list of cities. – Each city’s weather is highly cacheable • Using user-specific data (not part of the request) • Ex: My Prime Music page – Shows list of albums I own – Recommended playlists – Input often comes from a datastore
  • 37. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Example - Redirect • Viewer-request event and Origin-request event • Redirect to a login page for non-authenticated users • In viewer-request function validate the cookie • If cookie is expired or not present, redirect to login page CloudFront cache Viewer Request Origin Origin Request Viewer
  • 38. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 'use strict'; exports.handler = (event, context, callback) => { /* * Generate HTTP redirect response with 302 status code and Location header. */ const response = { status: '302', statusDescription: 'Found', headers: { location: [{ key: 'Location', value: 'http://mydomain.com/login.html', }], }, }; callback(null, response); }; Example - Redirect
  • 39. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Example - Content Aggregation Example: Weather App Landing page Client: Each user has a set of cities. http://example.com/weather?cities=Seattle;NYC Function: • Parses the URL • Fetches the relevant data • Sends the aggregated response to the client (app) CloudFront cache Viewer Request Origin Request Viewer
  • 40. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. function getCityForecast(request) { return new Promise((resolve, reject) => { https.get(request.uri, (response) => { let content = ''; response.setEncoding('utf8'); response.on('data', (chunk) => { content += chunk; }); response.on('end', () => resolve({ city: request.city, forecast: content })); }).on('error', e => reject(e)); }); } const uriSplit = uri.split('/'); const cities = uriSplit[2].split(':'); const forecasts = []; cities.forEach((cityName) => { const cityForecastUri = citiesBaseUri + cityName; forecasts.push({ city: cityName, uri: cityForecastUri }) }); Example - Content Aggregation
  • 41. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Promise.all(forecasts.map(getCityForecast)).then((ret) => { console.log('Aggregating the responses:n', ret); const response = { status: '200', /* Status signals this is a generated response */ statusDescription: 'OK', headers: { 'content-type': [{ key: 'Content-Type', value: 'application/json', }], 'content-encoding': [{ key: 'Content-Encoding', value: 'UTF-8', }], }, body: JSON.stringify(ret, null, 't'), }; console.log('Generated response: ', JSON.stringify(response)); callback(null, response); Example - Content Aggregation
  • 42. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What Else Can You Move to the Edge? Dynamic Customized Content (viewer location) Dynamic Personalized Content (user preference) Authentication Dynamic Content (News feed)Static Content (images,JS,CSS, …)
  • 43. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. CloudFront + Lambda@Edge Origin AWS Location AWS Location AWS Location AWS Location AWS Location AWS Location
  • 44. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Personalization • Identity: Authentication – know who the customer is • Information: knowledge about the customer • Preferences, Browsing/buying history … • Combine Identity and Information to create content personalized to that user
  • 45. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Authentication A mechanism to decide whether to serve this request or not: • Authentication using Trusted Signers (CloudFront feature) • Authentication - validated at the edge in the function • Authentication using remote servers
  • 46. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Accessing Data from Functions • Bundle with the code • Easy to use/access. Fast • Read only. Limited by size of deployment package. Change requires a deploy. • CloudFront cache • Close to the function (often in the same location). Periodically refreshed (TTL). • Read only • AWS DB offering (DDB, Aurora) • Read-write • Often in one region farther away from the function • Amazon DynamoDB Global Tables • Multi-Region, Multi-Master tables • Read-write, closer to functions
  • 47. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Content Generation - Personalization Example: We want to recommend new “items” when a user logs in Client: • https://example.com/index.html • User is logged in Function: • Fetch user’s history and preference from DDB • Generate response using the fetched data as input • Ex: • News articles based on my reading history • Music or Movie recommendations based on my listening/watching • Recommendations based on people you follow CloudFront cache Viewer Request Origin Request Viewer
  • 48. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. /* Access DDB */ var aws = require('aws-sdk'); var ddb = new aws.DynamoDB().DocumentClient({apiVersion: '2012-10-08', region: 'us-east-1'});; /* Get the item based on the user */ function getItems(request, context, callback) { const params = { TableName: ”recommendations", Key: { ”User": { "S": user } } }; ddb.getItem(params, function(err, data) { if (err) { console.log(err, err.stack); generateErrorResponse(request, callback); } else { console.log("Received output from ddb: " + data) generateResponse(request, data, callback); } }); } Content Generation - Recommendations
  • 49. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Serverless at the Edge Dynamic Customized Content (viewer location) Dynamic Personalized Content (user preference) Authentication Dynamic Content (News feed)Static Content (images,JS,CSS, …)
  • 50. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Demo
  • 51. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Serverless at the Edge Origin AWS Location AWS Location AWS Location AWS Location AWS Location AWS Location
  • 52. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Thank you!