Serverless with AWS Lambda

Routing & Express Q&A

Scott Moss

Scott Moss

Superfilter AI
Serverless with AWS Lambda

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

The "Routing & Express Q&A" 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 takes questions from students about router options, express, and more.

Preview
Close

Transcript from the "Routing & Express Q&A" Lesson

[00:00:00]
>> Scott: So any questions on Express, how it works with Serverless, why you should use it, or which method to use as far as routing goes, and the trade-offs and why you would use them? Cuz there's some pretty different use cases you would use a lot of this stuff for.

[00:00:20]
>> Speaker 2: HTTP isn't express specific is it? When you, the Serverless HTTP?
>> Scott: No, the service HTTP has nothing to do with Express. But Express, so services HTTP is based off of HTTP which Express uses. So because they share similar dependencies, Express just so happens to work with service HTTP.

[00:00:43]
But it wasn't designed to work with it. It's just service HTTP, and it follows the same API as HTTP does which Express uses.
>> Speaker 2: Do you know if most other server frameworks, I'm thinking Python specifically, I'm not sure if you would know this, but would a flask use HTTP also to communicate?

[00:01:00]
And so the process is probably pretty similar.
>> Scott: I don't know the exact library flask would use, but I'm 100% sure you can use flask on Serverless, yeah. I've come across it in the wild. I just don't know what the library is, cuz I don't practice Python every day.

[00:01:17]
>> Scott: I haven't written Python in two years. But it's my favorite language, actually. I just don't have a reason to write it. [LAUGH]
>> Scott: Any other questions on this stuff?
>> Scott: Cool, so this doesn't change any deployment. This doesn't change anything. You'd still deploy it the same way you would, and if you did what I did, where you commented these out, or you deleted these, when you do a deploy, these are already gone from AWS, completely gone.

[00:01:46]
They're not gonna be there. So that's supposed to happen, so don't freak out. I was like, what happened to my lambdas? I was gonna use them. Yes.
>> Scott: Question? What sort of routing would you suggest if you are using an enterprise app, with components like S3, DynamoDB, Kinesis, and so on?

[00:02:08]
If you're doing that, I would not recommend using Express because then you'll just get caught up writing a big old Express app, and you're not using service anymore at that point. Because the thing about service is there's limits. And yes, they keep increasing those limits, but you're still gonna have limits.

[00:02:25]
So you're looking at 250 megabyte file size limit. You're looking at execution time limits, memory limits. So the most you can shard that out and spread it out across multiple functions, if you're doing heavy things like Kinesis streams and S-tree and Dynamo, yeah, I would definitely make different functions for that.

[00:02:43]
Because they're all sound like they're doing different things. Whereas what we're talking about is more like this is just an API general thing. We're interacting with S3, and Dynamo and Kinesis and all these different functionalities, it almost sounds like completely different things. You should probably have those in different functions.

[00:02:57]
So, yeah, I would use different functions for those things and take advantage of native events and support that AWS would give you versus trying to tie that logic into Express yourself. Which you don't have to, if AWS gives it to you for free.

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