O’Reilly Fluent Conference 2018 – San Jose, California
O'Reilly · 6 lessons · Free on YouTube
About this course
everyone I’m super excited to be here so my name is Cherie Wong I work on Amazon CloudFront most of you are developers and whether you’re working on progressive web applications or back-end
applications there’s a lot of things that you really need to consider and that you’re always worried about and so this presentation is for us to kind of come to you with a few things that we’ve
heard that our kind of common pain points and we wanted to try to figure out if there’s there are recipes to just make things a lot more straightforward and a lot more performant so the three
things that we wanted to talk about today are authentication and authorization of your users security and how do you get a really good user experience because you have so many
different screen sizes to work with some of the things I’m going to talk about today there are many different solutions to but what we were really trying to do is figure out can we make it very
straightforward and easy and because I work on a content delivery network I’m very interested in performance so a lot of these recipes are focused on how do we get a lot more code and content at
the edge because we’ve got 117 edge locations and servers essentially in internet exchanges and carrier networks closest to your end-users and we want your end-users to have the lowest
latency and the lowest response time so let’s talk about authentication and authorization first there’s a lot of work in thinking about how to manage your users and how to manage your salt
and hash tables and so what we wanted to think about in AWS is a lot of different services that really help you with that so you can use kms or key management server for I was in your private keys
you have AWS Certificate manager so you can get free SSL certificates and manage your certificates there you can have the Web Application Firewall to think about how you want to manage rogue traffic or
bot traffic and kognito to authenticate your users and so this example is going to use Cognito your web application here your your user is going to an amazon Cognito sign-in page amazon Cognito
authenticate your user and it sends back an encrypted JSON web token and then what what happens then your application has this JSON web token but you still need to figure out is this user going to
have authorization to see the content or not and so in this exam gonna say you know there’s private content and there’s public content that they should see or they shouldn’t see
you could put that logic in your back-end application that means your request has to go all the way to your back-end application you need to decrypt your web token and you need to figure
out should this user have access to it or not which means it’s also handling a lot of requests that are probably invalid or that users don’t have authorization to actually see so you
have to scale your origin and you have to add in all this logic we’re thinking do you really need to modify your application logic for something that should be relatively straightforward and
so we thought about what can we do at the edge if your request comes into a content delivery network in this case Amazon CloudFront you can create a no js’ function for
with lambda edge and so essentially it’s gonna say hey this request is actually coming in for private content I’m gonna decrypt the web token is this user actually authorized to see this content
if so great send the request to your back-end application and surf the content back now if your user is not authorized to see this content not a problem at all you can use the same
lambda function to actually generate a response back like an HTTP for a one you’re not authorized to see this content so you don’t need to put any of that logic inside your application and
if it’s just regular public content it the requesters lands in clapeyron and it continues going to your origin and we we cache the content we serve it back so a lot of these recipes are kind of going
to have a little bit of the similar flavor of how do we just make things super easy to bring a lot of this logic and content to the edge so that’s author authentication and authorization next
security there’s a lot of content out there people are coming in through HTTP when you really want them to come over HTTP yes you want to really tell your web application what do you want to do
with cross-site scripting should you load scripts or style sheets and typically how you’re going to do that is you’re gonna send headers or security headers back in the response to from the
web request but then you again have to modify a lot of application code and so again can we simplify that so kind of the same pattern user request comes in do we have the content if so great serve
the cat content but if not then you can fetch the content and have your nodejs lambda edge function just add all these security headers in before the response
goes back to your end-user and so you’ve added all your HSTs headers or your cross-site scripting header is everything that you want to add straight from the edge another one is user
experience you’ve got so many different screens to deal with and so what are you going to do with all the different screen sizes and all the different sizes of images you may want to manipulate
your images to actually crop it to just the part of the image that is most relevant to the for the user or the screen size you may also want it to digital watermarking and so in this
situation we’re gonna have user send a request for an image maybe your web application says I want this image to be 100 by 100 you put the dimensions into the query string lambda edge can read
all the query strings and headers as part of your request and say hey do I actually already have this object in cache great serve the content but if not I can go and fetch the object and then
when the object comes back is it actually the image size and everything that we want yes so great cache it serve it but if not I can generate it you can resize your images you can add the
digital watermarking you can pretty much do whatever logic you want within this nodejs function cache it and then send it back so again authentication and authorization adding all the security
headers that you want and being able to manipulate your images so these were kind of the three common pain points that we’ve kind of heard of that we really wanted to make relatively easy
and then we thought well how do we make it just a little bit more exciting and so we thought about machine learning and some of us were thinking but well how are we gonna add machine learning at the
edge what are we how do we add machine learning in to live workflows and so this is a recipe I guess is fresh from the oven but the Royal Wedding everyone loves
Royals everyone wants to see them get married over and over again and what skynews really wanted to do is to machine learning and not just show the content but actually be able to say hey
here’s everybody that’s showing up and here’s information on them so it was pulling a lot of this data in and and bringing that into its own progressive and interactive live stream and so how
this really worked behind the scenes was we were ingesting a live stream into AWS elemental media services so you could ingest the stream it was adding the digital rights and then it was using
Amazon recognition to identify every celebrity and then using a different data source called grey media just to add that data in on exactly the profile of every celebrity so that it would be
able to show it on the video and on the website and then it served it securely through cloud forints as well so this was a really cool way of actually having a live work throw that was still doing
as much with security at the edge as possible cool so I hope you enjoyed a few of these recipes if you do want us to think of it more I’m happy to think of it more to swing by our views at
10:09 and here’s a few other vlogs and other examples of recipes that we shared as well so if you have any other questions feel free to reach out Thanks [Applause]
THERE IS ALWAYS MORE