A little bit of Lambda
This was my first live presentation and I presented on Sidecar, the open source library I wrote.
Transcript
Aaron Francis
anything, just chime in. I won't be watching chat, so just talk to me if you need anything.
Speaker 2
All right. All right. Okay, Aaron, the stage is yours. Take it away, man. Have fun.
Aaron Francis
Okay. Thanks. Um, well, thanks for putting this together, Frank. This is, um, my first live talk, live coding session, so I'm super stoked to be here. Um, so like you said, we're gonna talk about a little bit of Lambda. Um, we're gonna go over, um, a package called Sidecar that I wrote, but before we do that, just a little background on who I am.
Um, you can find me on Twitter @aarondfrancis. I'm a software developer in Dallas, Texas, here in the United States. Um, Torchlight is a software as a service that I've been developing that does syntax highlighting, and then the package that we're gonna talk about today is called Sidecar, and you can find that at hammerstone.dev/sidecar.
More important than any of that is I'm a new dad to twins, so I've got, um, two four-and-a-half month old babies. So that's probably the most exciting thing for me, but not what y'all are here to talk about, so-
Speaker 2
Congratulations.
Aaron Francis
Let's-- Yeah. Thanks. It's been a wild ride. Um, okay. So let's talk about, like, what the actual problem that we're trying to solve here is. And what we're trying to solve for is we have all of this great hosting optimized for PHP, and we have a couple that are, like, specifically tuned for Laravel, which is fantastic and doesn't seem like a problem.
Um, so we have, you know, Forge and Vapor, Forge plus Envoy or... and Vapor, and those are hosting providers that basically give us, like, more or less one-click deploy, and your Laravel app is live to the world. So this is, you know, fantastic news. Um, makes my life easy. I don't wanna be the server guy.
I'll let, you know, Fideloper be the server guy. I just want to be able to deploy my app and see it live. And we've got a couple others that aren't first party, um, that are probably very good, but I only use the first party ones 'cause they're, they're just so perfect. So with those first party, um, hosting, it's great when all you need is to live inside a Laravel application, and it does so much for you.
But what about when you wanna do, um, server-side rendering? Like with Inertia's new, um, SSR coming out soon, you're gonna need Node to be able to render, to do the actual server-side rendering. Or if you wanted to orchestrate Headless Chrome, or if you wanted to do some kind of, you know, 3D rendering, massive parallel.
Someone is using Sidecar to render like 700 3D renders all at once, um, and it just kind of blows my mind. But when you get into these situations, um, you either have to take on the burden of installing and maintaining these other languages, or you have to, um, you have to figure out a way to work around it, right?
So, and, and then with Vapor, like I was talking about, you don't really have access to the underlying system. So with Forge, you can get in there and install Node or Python or Ruby, but then you're maintaining Node, Python, or Ruby. But with Vapor, you can't even. Like, you have to, you have to bail out and do the container. Um, you can't use the n- the native stuff anymore.
So that leads us to a place where we may have perfect Laravel hosting, but we need to do one other, like, we need to do one other thing, like just use a single Node library for a very particular setup. So the solution would be you could use a whole lot of Lambda, right?
So you could use Lambda as it was intended to be used, and, um, you know, for a little bit of background, Lambda is, um, Amazon's, like, serverless functions, you know, functions as a service kind of thing. So you just deploy just specifically the code that you're wanting to run and all of its dependencies, and then you let AWS handle the rest.
You don't care, like, you don't have access to the server. You don't care about the server. A request comes in, they'll make sure that your code gets run, and they'll send the response back. So there are, you know, there, there are good ways to use Lambda, but they're all pretty heavy. The serverless framework is good, but then you're in this situation where you've got your Laravel app, um, in one repo, and then you've got your serverless app in another repo.
The deployments are run separately. Um, they can get out of sync, both in the deployments and the development. So you're trying to keep these two, these two things in sync. Like, they're-- it's all one application, but now it lives in two places. It's deployed in two places. They're talking to each other usually over the public internet, so you've got... you gotta set up API gateway, you gotta set up-- You have to secure your Lambda so that nobody else can call it, only you can call it.
And there is Vercel, which takes away some of that, um, but still you have a lot of the same, like, separate, separate repos, separate deployment processes, public internet, all of that kind of stuff. So what we're gonna talk about today is using just a little bit of Lambda, um, through Sidecar to solve this problem of I need a piece of Node.
And so with Sidecar, the Lambdas live inside your Laravel application. They're deployed alongside your Laravel application, and they're executed only through your Laravel application. So instead of having two repos, you've got one. Instead of having two deploy processes, you've got one. And then you don't have to secure, like, an API endpoint because there's, there is no API endpoint.
There is only executing it through Laravel. And so it takes, like, it takes the complexity of, like, vanilla Lambda and kinda turns it into the ease of use of Vapor, um- But for everything that's not PHP, right? So Vapor handles PHP, and then Sidecar will handle everything else.
And Sidecar can run anywhere. It doesn't have to be Vapor. Um, and Sidecar doesn't, specifically doesn't manage API gateway, databases, resources, anything. The only thing it concerns itself with is the packaging, deploying, and executing of Lambdas. So as Taylor would say, as DHH would say, "Show me the code." So let's take a look at some of the actual code, um, of how this stuff, how this stuff works, so we can see how easy it is.
So I have, I have here a vanilla, just plain, um, Laravel application. I have installed-- So I have composer required Hammerstone/sidecar. So that is, um, the package that we're gonna be talking about, and that's the part that manages all of this behind the scenes for us.
So first thing we're gonna do is artisan sidecar install, and that's just gonna publish a configuration file for us. There's a lot of stuff here, and we're not gonna cover, we're not gonna cover hardly all of it. Um, the documentation is pretty thorough. I tried to make it as thorough as possible.
So where I skip over stuff, it should be covered in the docs. But let's look at the Sidecar, um, configuration file. So all of this stuff is, um, just setting up some normal defaults, like the amount of memory, um, how long they should be allowed to run, that sort of thing. What we care about right now is this function registry.
This is where we're gonna put all of the functions that we create so that Sidecar knows, okay, I gotta deploy, you know, the render OG image, and I gotta replo- deploy process thumbnail. So those don't actually exist, so we're gonna get rid of those. Okay. What we're gonna do is we're gonna deploy a basic "Hello, world," um, Lambda.
And so every Lambda requires two things. We're gonna s- call this basic, and we're gonna call this index.js. Every Lambda requires two things. One is the package, um, of files that you wanna, you wanna upload to Lambda, and the other is kind of like a configuration, a PHP configuration class.
So for this one, I have a little bit of code here. All right. This one is just gonna say, "Hello from Lambda." This probably looks pretty familiar to people who have done some JavaScript. What we're doing is we have a hand-- or an export named handler, and it just returns the string, "Hello from Lambda." That's all that this does.
So we're gonna create... So that's the, um, actual stuff that runs on Lambda, and now we're gonna create the Laravel side of that. So let's create a new class called... What did we call this? Basic. Basic. Okay. New class Basic extends Lambda function. So Sidecar ships with an abstract class called Lambda Function, and it has all kinds of stuff under the hood.
But importantly, it enforces that two methods must be there. So we're gonna have PhpStorm implement those or stub those out. And these are the two things that I talked about, the package and the handler. So for the package, let's check the comment in the parent class. It says, "All the directories and files needed to run your function." Okay, that makes enough sense.
We're gonna say, um, since we are, whoop, we are in Sidecar basic index, let's just deploy, um, Sidecar basic. We're gonna deploy that whole directory. And then our handler is... It has to follow this specific format that AWS requires.
So it's the path to the file, and then the named export. So our file is called index.js, and our export is called handler. So we're gonna say index.js, you leave off the extension, and then the named export handler. So that's it. That's all that's required.
So now Sidecar knows what to ship to AWS, and AWS knows what to call when it's executed. So we need to add this to our registry. We're gonna say basic class. Okay. So now Sidecar knows those are all the functions I have.
Let's jump back over here and pray to the AWS gods. Sidecar deploy --activate. Phew. Hurdle number one. Okay, what just happened? So Sidecar said, "I'm gonna deploy that function that you registered, app sidecar basic.
I'm gonna deploy it to Lambda as sidecar, name of my application, environment is local, and name of the function." All of that's configurable. That's just the default. Then it gives you some helpful information about kind of what's going on here. The environment is local. Um, Sidecar will separate it by environment, so your-- each person, you know, each team member can have their own environment, staging can have an environment, and production can have an environment.
We're deploying a zip file. You can deploy, um, containers. This just happens to be a zip. The runtime by default is Node 14. This Lambda function did not exist, and so it had to create a new one, and then it packaged everything up, created a zip file, put it on S3, which is, you know, a requirement.
And then because we Said activate, it activated the function so that we could start using it. If we didn't call activate, it would just be sitting there waiting to be activated and you, and you couldn't use it yet. I'll explain that later. So creating alias for version one, which means, okay, the version you just uploaded is ready to go.
Let's take a look and see. So I'm in my AWS console. Um, hopefully there's no secret keys here. I'm in my AWS console. You can see, um, what Sidecar told us just happened did in fact just happen. So last modified one minute ago. Click in here, you can see Sidecar basic index.
So, so far, Sidecar has, um, packaged and deployed an AWS Lambda. So let's see if we can make it execute. So that's out there on AWS now. Let's jump over here, and instead of saying hello, we want to run, we wanna run the thing we just deployed, right?
So let's just see if with any luck, this is hurdle number two. Hello from Lambda. Live coding is working. Okay. So what just happened is Laravel called a Lambda, the Lambda executed, returned the response, and the response came back to the browser, which, like, seems kind of insane.
So let's just prove once again that that works. So what we're gonna do now is we're gonna pull, um, we're just gonna pull a random AWS environment variable out of their little, um, environment and plop it into our string just, just to like be triple sure that we're not running this on our local machine. We're not. Um, okay.
So we've updated the handler code, which means we need to redeploy both the, um, function. You can see Lickety Split, it is done. This time it said the function already exists, potentially updating. It created a new zip, and then it said activating version two. So that's that activating flag. We needed to make sure that the new one we deployed is now active.
So hello from AWS Lambda Node.js 14.x Lambda. So now we're like 100% sure we're running on Lambda. We pulled an environment variable out of the AWS environment and returned it back. So at this point, we have the pipeline totally proven. We've been able to write a JavaScript function locally, deploy it to Lambda, and call it through Laravel.
Um, it gets even wackier. Um, so if we do-- Let's see. What do we want to... I think it's runtime. So by default, if you look in the parent class, I just set Node.js 14. It could've been anything. Node seemed reasonable enough. But if you look on AWS's documentation, you can run, you can run all kinds of different stuff, right?
So if you, for whatever reason, I'm not here to judge, if you wanted to run Java 11 from your Laravel application or .NET Core 3.1, I don't even really, really know what that is. Um, if you wanted to do that, you could. So we're gonna run, we're gonna run Python just to prove that. Um, so instead of back to our function, instead of whatever we were just running, which I think was Node 14, we're gonna run Python 2.7.
So that does mean index.js is gonna be no good because it's gonna be looking for index.py. So I had to find this on the internet because likewise, I do not know Python. Um, now our handler is a, is a Python function, and it's gonna say hello from Python and then do the same thing.
It's gonna get the execution environment out. So let's look to make sure. So we're deploying the whole package, so our-- or the whole directory, so our index.py will go. It's still named index, so we don't have to worry about that, and it's still called handler, so we don't have to worry about that. So if we run this again, you'll see here the runtime was changed to 2.7, and version three is now active.
And that should... There you go. AWS Lambda Python 2.7. So now you're running, well, I'm running. Now you're running Python without having to have Python installed on your machine, which is pretty nice. Um, so let's look at something a little bit cooler.
Let's close all of that nonsense. Let us generate an image. Um, so once you start, like once you start to realize like, "Oh, I could, I could run anything from anywhere," then that's when your mind starts to go kind of crazy and be like, "Well, what do I, like what do I wanna do?" Um, so in this case what we're gonna do is we are going to generate some images on Lambda and send them back to Laravel.
So in this case, this is, um, just a very tiny, very hideous, um, bit of JavaScript that I wrote that's gonna use Node canvas to basically just draw an image. And graphic design is my passion, but this is, this is a hideous image, so just be aware. Um, one thing that we do here is we add a font, um, called Helvetica.
We add it to the canvas so that we can later use it, but we need to deploy that font alongside it. So I have those fonts backed up here It's just all the true type whatever. So let's copy that and put it in here. So this is showing you that you can, like, you can deploy anything you want.
There are certain size limits, um, but you can deploy anything you want and then reference it in your lambda. So it doesn't just have to be the handler. It could be an entire node modules folder if you want it to. All right, so this is our handler. What it's gonna do is it's gonna generate an image with the text "Hello LWW" on it. Okay? That's the handler side.
Let's jump back to the PHP side. We'll do new class, and we will call it image, and we'll say extends, what's it called? Lambda function. Add the stubs. In this case, we're gonna use a little bit different. There's the array format, um, but you can also do package make set base path to, uh, Sidecar image, I believe is what it is.
So that's the base path, and then we just want to include just everything that's in there, so just deploy everything. And because now we've kind of changed the base path, this part gets easier. So we just do index.handler instead of the whole, you know, file, file, file folder thing. Um, index.handler.
Good. Okay. Index.handler package is Sidecar image, Sidecar image, deploy the whole thing. Let's jump over to our registry. I'm gonna turn this off. You can deploy as many as you want, but just 'cause it's a demo, I'm gonna turn that one off. Okay, so now we are ready to hopefully deploy our second lambda.
Let's clear that out. Deploy and activate. There goes image, local node, do, do, do, alias. Okay, so we're all live and ready to go. Now let's see if we can make this work. Image execute. With any luck, this will be a base64 encoded...
Oh, so it says, um, it's ginormous, but it said, "Can't find module canvas." I forgot one very important thing. Fortunately, I know what. Um, so I said up here we're gonna require canvas. I didn't ship my node modules folder, um, but one thing that you can do is you can reference, um, you can reference layers.
And what layers are is they're little extra bits of code either provided by you or provided by the community, um, that AWS will add into your package for you. So in this case, what we're gonna do is somebody out there in the world has, um, somebody out there in the world has compiled Node Canvas specifically for Lambda.
And so we're just gonna, we're just gonna take advantage of that. Um, so I'm gonna tell Sidecar I've got these two extra layers, and those layers are compatible with Node 12, and I don't wanna recompile them. Um, so we will deploy, activate one more time. So now it's gonna have to add the layers.
Activating. Now Node Canvas should be available. Great. So it kind of worked, but that's not an image, um, base64. So which is what we expected, 'cause if you look at the handler here, it returns a base64 encoded version.
Um, so what we're gonna do here is we're gonna say that the result equals the execution. Um, saved. Um, the result equals execution, and then we're gonna base64 decode it and then return it with the proper header. Base64 decode, return with image JPEG.
We don't have to redeploy because we only changed the PHP side. So like I said, graphic design is my passion, and here's this beautiful image that I've come up with. Um, so what happened is the browser hit Laravel, Laravel hit Lambda, Lambda drew an image, gave it back to Laravel, gave it back to the browser with the correct headers, right? Um, we have added a nice little, um, way to kind of like encapsulate this.
So it would be nicer to just return the execution, right? So these classes do, I forget what it's called, um, I think it's toResponse. Yeah. So if you, in your, in your Sidecar class, if you're always gonna be generating an image, you can just always return an image. And I think that is the right way to do it.
ToResponse, toResponse. There you go. So now we're back to the nice, neat, I just wanna return the execution part. So we can get even cooler, if that's, if that's not cool enough, um, by, um, taking in information from Laravel and using it in our lambda.
So we had this hard-coded, "Hello, LWW." We're just gonna pull a value off of, um, this event here. And this event is provided to us by AWS. Um, but the way that Sidecar is set up, you can send stuff through that event, and it's just ready f- ready to go.
So we did change handler, which means we need to redeploy, and it will notice that something has changed, so it's creating a new zip file It does like a MD5 hash of everything to make sure that stuff has changed. So image number three, yes. We should see undefined here.
Classic JavaScript. Um, so then what we can do is just say text, "Hello from Laravel." Let's be excited about it. Okay. Okay, so now Laravel has sent along some extra information.
Lambda has picked it up, used it, and sent the response back, which of course means you can do anything. You control both of them. You control Laravel, you control the Lambda, so you can set it up to do whatever you want, which I think is a good... ch-ch-ch-ch. Yeah, let's look at the next one, because the next one gets even a little more sophisticated.
So if we do, we're gonna create one, um, we're gonna create a Lambda that is going to drive Headless Chrome through Puppeteer, take some screenshots, and send it back. Um, so let's do the same thing, extends Lambda function, add our method stubs.
Um, this one, because it's driving Chrome, it's gonna be a little heavier, so we're gonna up the memory on this one to forty ninety-eight. Um, and so with, with AWS Lambda, the more memory you give it, the more CPU you get. It's a wacky calculation, but I promise that it's true.
Um, so let's see. We have another layer here. Someone out there has built Chrome specifically for Lambda. Um, so you can look at it here. Google Chrome for AWS Lambda as a layer. It, I mean, doesn't get more perfect than that.
So we're gonna use that, um, so that we don't have to compile Chrome for, um, AWS Lambda. So we're gonna use that. Our package is gonna be, um, let's just copy this. We're gonna use the same package make, set it to Sidecar screenshot, and include the whole directory.
And there's currently nothing in that directory. So let's do index.js. That's where we're gonna put our handler. Close that. And ch-ch-ch. So because we set the base path, then we can just use the file. The handler is index.handler, send the whole screenshot directory.
It's more, it's heavier, so we need to use more memory and use the Chrome layer. Okay? I think that's good so far. And then the actual, um, the actual handler is another similarly complex, um...
So we'll just walk through real quick what's going on. So we're gonna pull Chromium out, and that comes from the layer, so I'm not having to ship node modules or anything, which you can do. Um, but that comes from the layer, so the layer will provide Chrome AWS Lambda. I'm just gonna require it. Then we're gonna get a browser instance, um, by launching it, setting up some stuff.
And then in our handler function, um, we're gonna set up the viewport. We're gonna go to whatever URL we pass in, um, so that's gonna come from the Laravel side. And then we're gonna take a screenshot and send it back. Um, so here's the screenshot. Image is await page.screenshot.
And then we're gonna send it back along with some extra, you know, meta information. So, um, we can use that back in Laravel if we need to. Okay, so I think we're good. So we've got the whole handler. It's named handler. It returns the stuff, memory, layers, package, handler.
And let's just turn that one off. Screenshot class. So now we're registering it to let Sidecar know we need to deploy this one. Okay, screenshot, creating new function, alias version one. Okay, good so far.
So now we can do, um, let's say, uh, let's just go ahead and do this. Let's just return screenshot, execute URL. Let's see if Google allows such a thing. Um, coming from Lambda, you may not be able to access everything.
But, um, if they allow that, then we're good. We do need to implement the toResponse method, because if you look at what we're actually returning from the handler, we're returning, um, a Base64 encoded image, but it's also nested in this object. And so we're going to return, um, we need to basically do the same thing we did last time, which is turn it into a real image.
So let's do toResponse. Same deal as before. Um, the body is the result which is passed into you from Sidecar. Then you Base64 decode our special key that we set it as. We set it as image. Um- Then we're gonna return the image with a header of, um, whatever type of image.
So in this case, you know, by default, I think it's JPEG. Okay, so now let's see if we can execute a screenshot, Headless Chrome, I'm nervous, Headless Chrome on Lambda. So it is a cold boot, so it's gonna take a second, and then it's gonna have to launch Chrome for the first time. But ta-da, it's a screenshot.
Um, so Laravel called Lambda, Lambda launched Chrome, Chrome went out to google.com, then Puppeteer took a screenshot of that, Base64 encoded it, and sent it back to Laravel. So I mean, we can-- It's controllable, right?
So now that it's no longer cold, this should be faster. So it's not cold booting, um, the, the container, and it's also got an instance of the browser cached, and so it doesn't have to do that again. So you can see that the time gets a lot faster. And depending on how you set up your handler, you can do all kinds of crazy things.
Like, you can make your handler as dynamic as you want. So our handler in this case, we did... Here we go. Let viewport equals twelve hundred by six thirty with a doubling for retina, but also destructure event, event.viewport. So if you send in viewport, it's gonna overwrite these two things.
So then on your Laravel side, you can just say, "Ah, you know what? I want it four hundred by four hundred," and it should come back as eight hundred by eight hundred. There you go, 'cause it's doubled. It's pixel doubled. Um, so I hope that gives you some kind of like, um, pathways to be thinking about how dynamic, like how dynamic can I make my handler such that I don't have to keep redeploying it all the time.
I can just deploy it for big changes, and I can control everything from the Laravel side. So last one I wanna show, this one is gonna be super quick. Um, I wanna show one super nice thing that Sidecar can handle for you. All that we've been doing here is kind of like request, response, like do a thing, give me the response, do a thing, give me the response.
Some people-- I asked on the Sidecar repo, I asked some people like, "Hey, what are you using Sidecar for?" 'Cause my, um, I'm just like, "Generate an image." And some people were like, "I'm spinning up screencasts. I'm rendering. I'm using Python to render 3D models." Um, so one really nice thing that you can do with Sidecar is, um...
Well, let's just show you. Let me just show you. So this handler, all it's going to do is, um, return a UUID. So it's just gonna return a super long random string. Um, but before it does that, it's gonna sleep for a full second. So it's just gonna make a promise that resolves after a thousand milliseconds.
So this, you would expect, will take about a second, right? So we can copy the basic one and call this random, random, random, random, and we'll let that default to fourteen. Okay, so we have a random function in the random folder with index.handler, um, handler, and it's just gonna return
a string. Random, Sidecar random, Sidecar random. Let's add it to our registry here. Random. And let's deploy this. Random, creating new.
That was fast. Um, okay. So return random, execute. We would expect this to take about a second. The first one's gonna take longer, um, because it's cold booting. So one point two, one point two, one point two.
Yeah, that's about right. Now, if you wanted, um, to get five or... I don't wanna wait that long. If you wanted to get three of these things, you would do it like this. But this is, I mean, this is gonna take, it's gonna take three seconds or more. So you've got three functions.
You can see three UUIDs all coming back. Um, and it takes about three seconds, which if you're doing like one and one, one and one, it's fine. Just, just wait for it. But if you're trying to s- you know, if you're trying to spin off like 80 Lambdas, you don't, you don't wanna wait for it. So we have a way. We're-- Let's do, um, let's do execute many, and instead of executing three, we're gonna execute, let's say, ten.
So let's get rid of this. We're gonna say the results equals ten executions, and then I think we do return collect results, higher order map, pull out the body. So what this is gonna do is it's gonna execute ten Lambdas, map through the responses or the results, and pluck out the body, which should be the UUUID.
Um, let's watch the time. So we just got 10 of them, you can see them all there, in the same time, uh, more or less, that it took to get one, right? So we're doing 10 in 1.3 seconds versus one in 1.2 seconds. And this is when I said there's some guy running, you know, 700 concurrent, this is what I'm talking about.
This is what he's doing. He's running, for whatever reason, he's running 700 async executions, right? So that's really useful, um, in cases where maybe you're doing a bunch of different things, and you can pass through. I mean, you can pass through different payloads.
This function doesn't accept a payload, so it doesn't really matter. But you can pass through different payloads, and they will all get, they'll all get executed. Um, in this case, it doesn't do anything. So you can pass through as many as you want, um, fully loaded payloads and everything. And what Sidecar's gonna do under the hood is it's gonna dispatch all of them, and then it's gonna wait.
Once they're all dispatched, then it's gonna wait for the responses to come back and collect them all together. If you wanted to, you could also, um... Let's say you wanted to execute 15 async. Um, in, in this case, it's not gonna wait at all.
So it totally breaks out of the request-response, um, cycle. They're out there running on Lambda, um, but it's not gonna wait for them. So you can see we're getting it back in default Laravel times. Um, so you can do execute many async, you can do execute async, um, and pass through a payload. So there are tons and tons of different, um, different things that you can do with Sidecar, even, even just in terms of execution, not to mention in terms
of deploying a container, um, deploying any sort of runtime that you can find. Um, anything like that, you, you can do. Um, so hopefully this gives you some kind of insight into, like, the next time you're trying to reach for just, just one node or one Ruby or one Python script, you're not thinking, "Well, now I gotta go set up Vercel," or, "I gotta go figure out the serverless framework." Hopefully you can look at
this and see, "Okay, I can keep it within my Laravel stack. Like, I'm just doing one thing. I can keep it within there." Um, and you don't have to, you know, jump to microservices because you're forced to set up node. There's a bunch more. Um, the deploy activate thing is so that you can deploy, um, from CI and then activate from production so that y- you know, they stay, they stay, like, exactly in sync.
Um, so there's all kinds of other great stuff. Um, we can do pre-warming, so you can pre-warm 100 containers. Like, if you're doing server-side rendering and you deploy a change, but you don't want your page speed to drop, you can pre-warm 100 containers and then activate it so you don't have the Lambda cold boot thing. So take a look at the docs.
There's a ton more. Um, that is basically all that I have. Um, I have a slide that says, "That's all that I have." So that's all that I have. So Freek, back to you.
Speaker 2
Yeah. This was, uh, really mind-blowing, Aaron. Really. Uh, let me show you some, some stuff from, from the comments here, and it got-
Aaron Francis
Sure
Speaker 2
... all over here. "Man, that is so cool. Whoa."
Aaron Francis
Oh, thanks.
Speaker 2
"Amazing stuff." And here, another one, and I totally agree with this. "This is some Laracon level stuff." So I think, uh, I think you nailed it, uh, in this talk.
Aaron Francis
Oh, thanks. That was my first talk, my first live coding experience. I'm just so happy that AWS didn't crap out on me.
Speaker 2
Yeah. I was, uh, saying that in the comments here as well, that it's really courageous to do that because- ... yeah, if at this moment AWS would crash, then people would've seen this, this awesomeness.
Aaron Francis
Yeah.
Speaker 2
Yeah. Personally, I, I really like, yeah, how polished that this package feels. Um, you know, you showed that two response methods, and I thought, yeah, that's something that you added, uh, for yourself, and you saw-
Aaron Francis
Mm-hmm
Speaker 2
... that, yeah, this is very nice for, uh, for others too.
Aaron Francis
Yeah. Yep.
Speaker 2
What, what I'm also thinking is, yeah, you showed us, uh, a couple of cool, uh, use cases already. Uh, like, um, yeah, visiting URL, getting a screenshot, generating an image. I'm thinking, and, and maybe it already is, is out there, wouldn't it be very nice if those would be also packages as well for if people-
Aaron Francis
Yes, big time
Speaker 2
... just want, want to create an image?
Aaron Francis
Yep.
Speaker 2
There's already a Sidecar package for that with a-
Aaron Francis
Yep
Speaker 2
... decent API on the, on the Lambda function.
Aaron Francis
Yeah, so if you create, if anyone creates a Sidecar packaged up function, let me know. I will put it anywhere I can, as publicly as possible, because I think having those off the shelf ready to use is gonna be extremely nice for everyone.
Speaker 2
Yeah, I think so too. Um, I'm also feeling that this, this talk, it would also benefit from, like, a part two with, like, how does it work behind the scenes, you know?
Aaron Francis
Yeah, a deep dive. It's kind of fun.
Speaker 2
Yeah.
Aaron Francis
Yeah.
Speaker 2
I can, I can imagine. I can imagine, like, zipping the stuff and sending it to Able-
Aaron Francis
Uh
Speaker 2
... uh, AWS. So-
Aaron Francis
Yeah. There's some, there's some cool stuff in there. Like, the zip file never hits your disk. It uses streams. So it does a zip stream-
Speaker 2
Mm
Aaron Francis
... and then sends it off, and yeah, it's fun.
Speaker 2
Mm. Maybe we need to talk about the part two, uh, Aaron.
Aaron Francis
Yeah.
Speaker 2
But first, you should rest a little bit and just-
Aaron Francis
Yeah
Speaker 2
... feel happy with yourself because you did really an awesome job here, I think. Uh-
Aaron Francis
Thanks. I appreciate it. Thanks again for having me.
Speaker 2
Is there something else that you want to plug? Um-
Aaron Francis
No, just Aaron, Aaron D. Francis on Twitter. Um, let me know how you use Sidecar.
Speaker 2
Okay, cool. Thanks again, uh, Aaron, and, uh, until the next time.
Aaron Francis
Bye.
Speaker 2
Okay, people. Um, that was the first talk. I hope that you liked it as much as I did. Uh, we are going to have a little break now, and we'll be back with Luke's talk in just a few minutes. Enjoy the break.