Introduction to the serverless framework.
The Serverless Framework is a powerful and popular open-source framework that simplifies the process of building, deploying, and managing serverless applications. With its extensive features and integrations, the Serverless Framework empowers developers to focus on writing code without worrying about infrastructure provisioning or scalability. It supports multiple cloud providers, such as AWS, Azure, and Google Cloud, enabling seamless deployment of serverless functions and resources. By leveraging the Serverless Framework's abstraction layer, developers can enjoy the benefits of reduced development time, cost efficiency, and auto-scaling capabilities, making it an essential tool in the modern era of cloud computing.
Pre-requisites
Launch EC2 instance
Install Node.js on Ubuntu 22.04
- To install Node.js on Ubuntu, you can follow these steps
Open a terminal on your Ubuntu system.
Update the package lists for upgrades and new installations:
sudo apt update
- Once updation is done install the required repository:
curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -
- Install Node.js using the package manager:
sudo apt -y install nodejs
- Install the npm package manager, which is bundled with Node.js:
sudo apt install npm
Verify the installed version of Nodejs and npm:
Now Install serverless module via NPM:
npm install -g serverless
Install AWS CLI
sudo apt install awscli
Install Postman for API Testing
- To download Postman for your operating system, you can visit the official Postman website at:
https://www.postman.com/downloads/
On the downloads page, you'll find the available options for different operating systems such as Windows, macOS, and Linux. Simply click on the appropriate download link for your operating system to initiate the download.
Create your postman account .
That's it! Our installation work is done. Now we can setup our serverless account smoothly by clicking on this URL " URL "
Login to your Serverless account
- Navigate to your existing project
Copy the project URL (
$ serverless --org=mehboob1129
)Run the project on your server using the copied URL
Choose the relevant serverless service based on project requirements, such as AWS HTTP API.
Provide a project name for identification purposes.
Create an IAM user in your AWS account for connecting Serverless Framework with AWS.
Assign the IAM user the "Administrator access" policy for necessary permissions.
Generate access and secret key for the IAM user to authenticate with AWS services when integrating with the Serverless Framework.
"IMPORTANT FILES"
#index.js & serverless.yml
"RUN THIS COMMAND TO DEPLOY"
serverless deploy / sls deploy
"As we can see we have successfully deployed our serverless project "
This is our "CLOUD FORMATION STACK" in Diagram.
Project overview on serverless framework
We have successfully deployed our first simple serverless application.
"This simple practice serverless project demonstrates all the prerequisites and installations required for a Mega project on AWS Serverless (Part-2)."
"Thank you for your interest in my project "