How to create a mail server using Lambda, API Gateway and SES service of AWS?


Here are the steps mentioned on how to configure a mail server using AWS serverless services such as Lambda, API Gateway and Simple Email Service(SES):

  1. Install node .js software in the host system(Desktop/PC/Laptop). Type install node .js in Google Chrome Browser.

2. Once node software is installed, make sure that serverless configuration is done through AWS. The steps for serverless configuration are as follows:

a. Create a IAM user with Access key and Secret key Authentication selected.

b. Once the user is created, the access key and secret key needs to be copied and we need to write a command to first login to serverless using command prompt. The command is:

serverless config credentials --provider aws --access key <access key> --secret <secret key>

c. Once this is done, execute the following commands to create a folder for our serverless projects.

  1. cd Documents.
  2. mkdir aws_2022_data.
  3. cd aws_2022_data.

d. Now, we are in the aws_2022_data folder where we will do our basic serverless configuration. The process is as follows:

  1. serverless.
  2. It will ask for a project name, Enter the project name as aws-node-project.

3. Deploy the project as it will ask whether you want to deploy the project or not.

4. The aws-node-project will be created and a lambda function will be also created for the project automatically.

No alt text provided for this image

5. Enter the command dir to check the files present in the project(by default).

No alt text provided for this image


3. Now, as the basic serverless configuration is completed, we now need to upload the configuration files which are required for this project and make some changes to the handler .js, serverless.yml file and also add index.js file to our project folder so as to develop the front end.

Note: These files are stored in a github repository. Save the raw file from there in your system(in the project folder).

No alt text provided for this image


4. Once the file is stored in the project folder , check the file content by the commands:

a. notepad serverless.yml

b. notepad handler.js

5. The configuration files are now stored in the project folder and the final step is to deploy the aws-node-project.

Type the command: sls deploy.

6. The API gateway endpoint will be shown in the command prompt interface.

7. Go to Postman Software and POST the content as shown below and sent the POST request to the API endpoint(paste the API endpoint there and select BODY).

No alt text provided for this image

8. Once this message is displayed in postman, check the mail of the "to" mentioned in Postman whether the test mail is received or not.


No alt text provided for this image


9. The mail server is configured successfully and we can now send any mail through this mail server either through the front end or through the Postman software.

10. Note: The API gateway endpoint is also available in the API gateway service of AWS.






To view or add a comment, sign in

More articles by Aditya Jogwar

  • Terraform Learnings

    I would like to share my further terraform learnings in this blog. If we do not want to delete all the resources which…

  • Terraform Learnings Day 2

    I would like to share some more information about terraform. HOW TO CHOOSE THE RIGHT INFRASTRUCTURE AS A CODE TOOL? The…

  • Terraform Learnings

    I would like to list my terraform day 1 learnings along with the detailed explanations of all the points. Terraform is…

  • How to configure EFS with an EC2 instance in AWS Cloud?

    Before starting the procedure on how to configure EFS, let's have some look at what is EFS? EFS is known as Elastic…

  • How to host a static website on AWS S3?

    What is AWS S3? AWS Cloud has a serverless service available popularly known as S3(Simple Storage Service). It is a…

  • How to host a static website in an EC2 instance?

    We need to go through the following steps to host a static website in an EC2 instance in AWS Cloud. The steps are as…

Others also viewed

Explore content categories