Check out a free preview of the full Serverless with AWS Lambda course

The "Lamda@Edge" Lesson is part of the full, Serverless with AWS Lambda course featured in this preview video. Here's what you'd learn in this lesson:

Scott discusses globally distributed lambdas push traffic and using Lamda@Edge service to customize the content that CloudFront delivers.

Preview
Close

Transcript from the "Lamda@Edge" Lesson

[00:00:00]
>> Scott Moss: Which brings me to my next point, globally distributed Lambdas and what does that mean an how do you use them. So it's a couple of things. You've got AWS on route 53 which is basically, it's like their DNS or whatever. But the cool thing about route 53 and what it lets you do, it will route.

[00:00:21]
So if you make a Lambda in every single region on AWS and I'm not talking about on the Edge, but just you make a Lambda. You push one, the same Lambdas at every region and then you use route 53 to determine which Lambda to route to, depending on where the client is making that call from.

[00:00:37]
So it's basically like a CDN, but it's not on the Edge if that makes sense. So you use route 53 to push traffic to different Lambdas that are closer to your customers. So that's really cool. But if you really wanna truly get on the Edge, what you're gonna want is Lambda@Edge which is basically Lambda functions on the Edge.

[00:01:01]
So if you don't really know what a Edge is in CDN, basically a CDN is a network of nodes across some region or globally. And whenever you make a request instead of going to an origin server somewhere in like Oregon if you're in Florida, you're gonna go to the closest node to you which might be Orlando or Jacksonville or something.

[00:01:21]
And then that node, what it normally would do is just like if you're asking for the same thing, it would send it back to you, cuz it's cached. But now because you can write Lambda on the Edge, you can actually do computations right there. Instead of just sending back a cached object, you can write a Lambda function.

[00:01:37]
You can do anything you want there. So now when somebody hits the Edge server which might be right next to them, you can do whatever you want. You can do an AB test. You can make a call to another API. You can access your globally distributed database. So therefore, if you think about it, you have like the whole CDN as your origin.

[00:01:54]
You no longer have like a single origin anymore like every node is your origin and this makes your APIs like sub 100 milliseconds, depending on what you're doing. So you could create some of the world's fastest APIs by using some of this stuff and Lambda on the Edge is pretty dope and they're upgrading it all the time with lesser limits and all types of crazy stuff.

[00:02:13]
When it first came out, you couldn't really do much with it. Like you couldn't make calls to the internet and some of these functions couldn't do a lot of things like the limit was like the code limit was less than a megabyte, it was ridiculous. But now, it's pretty good.

[00:02:28]
It's not the same limits as regular Lambdas, but it's still really good on what you can do with it. So I highly recommend checking this stuff out. This is the next generation of something you would have done with VCO on fastly or something like that, if you've ever used a CDN and had to use VCO language to do some kind of like a computation on a node there.

[00:02:49]
This is the equivalent of that by the next generation. Speaking of the Edge, Cloudflare workers just got announced and they're currently in beta and these are basically Cloudflare's version of Edge functions. Cloudflare is one of the best CDN in the world and I kinda like their approach better than what Lambda Edge is doing.

[00:03:10]
It's way simpler in my opinion and it doesn't take 30 minutes to deploy. So I would recommend checking this stuff out. They're doing some pretty interesting things and the team is like so active. It's like you could just email them and tell them what you want, and they'll book a meeting with you like what do you want?

[00:03:24]
And they'll try to make it. They're really cool like that. So again, this allows you to do computation on the Edge which is very like powerful. Super amazing, you can do all types of crazy shit there on the Edge like it's amazing.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now