This is a simple serverless CRUD application in nodejs.
- Serverless Computing: AWS Lambda
- Database: AWS DynamoDB
- API: AWS API Gateway
- Serverless CLI: Serverless Framework
- AWS account
- Nodejs installed in your machine
- Install serverless
npm install --global serverless
- Basic understanding of nodejs and javascript syntax
- Configure AWS credentials in serverless
Open IAM in your AWS account. Create a new user and give AdministratorAccess.
Download the Key pair csv. Save it properly, as if lost there is no way to retrieve it.
This is an educational project. For production, please configure the user access accordingly.
There are 2 ways configure the AWS credentials in the serverless framework.
This will configure the AWS credentials to the local instance of the serverless CLI.
To configure run the below command with the correct access key and secret.
serverless config credentials --provider aws --key <ACCESS KEY> --secret <Secret Access key>
Check out this quick tutorial - Link
Create an account in the https://serverless.com.
Create a new app.
Select serverless framework template.
Enter the app name.
Copy the app properties
org: <org-name>
app: <app-name>
Open the serverless.yml
and paste the app properties in the top.
org: <org-name>
app: <app-name>
service: basic-sls-crud-service-node
Open the terminal in the directory of the serverless project.
Login to serverless account from serverless CLI
serverless login
Connect with AWS
Open the app setting from the serverless dashboard. There is a 3 dots menu in the app card.
Go to stages > Select default > Connect AWS
You can create multiple stages according to the application environment.
To deploy the application run the below command
serverless deploy
It will create all the API routes configured in the serverless.yml
.
Test the endpoints using the curl
command or Postman.
To learn more on serverless check out my latest tutorials.