Skip to content

yusufyucel-dev/aws-serverless-contact-form

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 

Repository files navigation

aws-serverless-contact-form/ β”‚ β”œβ”€β”€ lambda/ β”‚ └── index.js # Lambda function code β”œβ”€β”€ screenshots/ # Documentation images β”‚ β”œβ”€β”€ ses.png β”‚ β”œβ”€β”€ iam.png β”‚ β”œβ”€β”€ lambda.png β”‚ β”œβ”€β”€ apigateway.png β”‚ β”œβ”€β”€ cors.png β”‚ β”œβ”€β”€ curltest.png β”‚ └── architecture.png └── README.md

πŸ“§ AWS Serverless Contact Form

This project demonstrates how to build a serverless contact form backend entirely on AWS, without managing any servers.
It integrates multiple AWS services to process form submissions securely and deliver emails directly to a verified address.


⚑ Architecture

Architecture

Workflow:

  1. User submits the form on the website.
  2. API Gateway receives the POST request.
  3. Lambda function validates and processes the input.
  4. Lambda uses AWS SES to send an email.
  5. CloudWatch logs every execution for monitoring.

πŸ›  AWS Services Used

βœ… Amazon Simple Email Service (SES)

  • Verified sender/receiver email identity.
  • DNS validation completed in Route 53.
  • Configured to send emails within SES sandbox (only verified emails allowed).

βœ… AWS Lambda

  • Written in Node.js to process incoming POST requests.
  • Sends formatted email through SES.
  • IAM execution role attached with:
    • AmazonSESFullAccess
    • AWSLambdaBasicExecutionRole

βœ… Amazon API Gateway

  • Created a REST API with POST /contact.
  • Integrated directly with Lambda function.
  • Enabled CORS to allow cross-origin requests from the frontend.
  • Auto-deployment enabled on $default stage.

βœ… AWS Identity and Access Management (IAM)

  • Created an execution role for Lambda.
  • Permissions attached:
    • logs:CreateLogGroup
    • logs:CreateLogStream
    • logs:PutLogEvents
    • ses:SendEmail, ses:SendRawEmail

βœ… Amazon CloudWatch

  • Monitors and logs Lambda executions.
  • Used for debugging email delivery issues.

βš™οΈ Steps I Followed

  1. Configured SES

    • Verified email identity.
    • Added DNS records in Route 53.
    • Confirmed verification via email link.
      SES
  2. Created IAM Role

    • Execution role for Lambda with SES + CloudWatch permissions.
      IAM
  3. Developed Lambda Function

    • Node.js function to send emails via SES.
    • Deployed directly from AWS Console.
      Lambda
  4. Setup API Gateway

    • Defined POST /contact route.
    • Integrated with Lambda.
    • Enabled CORS: * origin, POST method, content-type header.
      API Gateway
  5. Testing the Contact Form

    • I tested the API Gateway endpoint using cURL.
    • The Lambda function was triggered and the email was successfully delivered through Amazon SES.
    • The screenshot below shows both the terminal output and the received email example.
      Testing
  6. Amazon Route 53

  • Hosted Zone was configured for the custom domain yusufyucel.com.
  • DNS validation records were added for Amazon SES, allowing emails to be sent using the same domain.
  • This setup not only enables static website hosting but also ensures that outgoing emails use a professional domain identity.
    Route53 Website

βœ… Outcome

-A fully serverless contact form backend deployed on AWS. -Scalable, cost-efficient, and requires no server management. -Emails successfully delivered through Amazon SES.

πŸ”— Resources

-Amazon SES Documentation = https://docs.aws.amazon.com/ses/ -AWS Lambda Documentation = https://docs.aws.amazon.com/lambda/ -Amazon API Gateway Documentation = https://docs.aws.amazon.com/apigateway/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published