We compare Netlify Functions with AWS Lambda and talk about why we'd move from one to the other. Netlify Functions is a high level DX on top of AWS Lambda, so we'll have to find a new DX as well.
Instructor: [0:00] So far, we've been using Netlify Functions. It's been pretty good to us. We've been able to use it to deploy functions alongside our actual application including deploy previews and rollbacks.
[0:12] This has been pretty powerful because we originally built our application on Fauna and we wanted to swap to DynamoDB. When we did that, we shipped it as a pull request on GitHub.
[0:23] When we shipped it as a pull request on GitHub, this deployed our entire client-side application along with the serverless function so that we could test the entire application in production before merging that pull request.
[0:35] Netlify Functions also integrates really well with Netlify Identity which we've been using for user authentication. We haven't had to deal with uploading anything to S3. We haven't had to deal with AWS Lambda directly, and we haven't had to touch the AWS console for anything to do with our Lambda functions. There are a couple things we need that Netlify Functions doesn't currently give us.
[0:56] The big one that we just ran into is the declaration and usage of IAM roles. Currently, we're using our root access token and root secret key to power our Lambda in production. It will be really nice if something took care of these IAM roles for us. With AWS Lambda, our Lambdas can assume an IAM role when they run, rather than running with a full account.
[1:19] In addition, we're going to want to take advantage of DynamoDB Streams now that we've moved our database over. DynamoDB Streams allow us to trigger a Lambda every time a change happens in our database.
[1:30] Netlify Functions doesn't integrate DynamoDB Streams in the same way. Once we start deploying functions that can work with DynamoDB Streams, it makes a lot of sense for all of our functions to be deployed in the same place.
[1:43] Finally, there are a few other reasons. Even though we won't be using them in this set of videos, AWS Lambda and API Gateway allow us to use WebSocket integration powered by Lambdas. Netlify Functions doesn't currently offer WebSocket support.
[1:59] One other difference is that AWS Lambda can run at the edge, which puts our functions closer to the people who are using them. Netlify Functions doesn't currently have an edge support.
[2:10] In the end, AWS Lambda gives us a little bit more power and a little bit more functionality in exchange for more effort on our end dealing with configuration, our own deployment pipelines, etc.
[2:22] It's important to note that Netlify Functions runs on AWS Lambda. We're moving from a high-level solution to a lower-level solution.