Serverless Cloud Functions with the Serverless Framework and AWS Lambda
Are you interesting in creating serverless cloud functions that allow one to:
- Have backend routes without a server.
- Use DynamoDB and S3 and other AWS Triggers.
- Grow your user base and scale up quickly.
If the answer to any of these questions is yes: you need to keep listening. Because I am about to deliver a podcast based upon this topic.
Using the Serverless framework one is able to create these cloud functions such as one would be able to in Google’s Firebase or MongoDB’s Realm. These “serverless” functions (meaning they do not require a server to use) allow one to deploy their backend functions to AWS Lambda.
Serverless functions are good for websites; desktop or mobile apps which are expecting a large user base and therefore are able to be scaled quickly. This means the application can go from having no users to billions of users without the server breaking. If the application uses serverless functions there should be little to no difference between the application having no users to the application having the previously aforementioned amount of users.
Step One: Navigate to the Serverless Website.
The first step in creating serverless cloud functions is to go to the Serverless website. This can be found at serverless.com. From there one is to create an account and then it will ask you for AWS keys. The AWS key id and AWS secret key id can be found in your AWS AIM section of the platform. Once you have generated new keys it is customary to migrate these keys to the serverless.com website.
From here one creates their first serverless application. There are many good boilerplates or starter templates that allow one to create their first serverless application. I have chosen the express starter template as nodejs and express is my favorite frameworks for backend development.
Once you have selected the starter template one is to navigate to the directory of their IDE or Terminal and install serverless with a
npm i -g serverless
From there one is to initialize their serverless project with a:
serverless init <id>
You are now free to develop your express backend with serverless! AWS Triggers can now be added to your application.
To deploy the application one is to write:
serverless deploy function -f <nameOfProject>
And whoop there it is: you have deployed your serverless function to AWS Lambda!