Serverless feedback form using S3, Lambda, DynamoDB, SES, and API Gateway

Serverless Forms using Lambda

The walkthrough below provides the front end code for a serverless contact or feedback form as well as the necessary steps in AWS to setup and deploy the stack. Code for both the front and back end are on github:
https://github.com/kyle138/feedbackform.

SAM

The code in this repo is deployed using AWS SAM. This will need to be installed and configured before deployment.
After the first deploy a new secret will be created in AWS Secrets Manager, it will need to be updated with your SES email address created below.

SES

  1. Verify a New Email Address (email address you control where feedback will be sent)
  2. Make note of the verified email addresses to add in the AWS Secret created after the first AWS SAM deploy using the format below.
                  
                    {
                      "SENDER": "Feedback Processor ",
                      "RECEIVER": "youraddress@youremaildomain.com"
                    }
                  
                

S3

All files and folders within the S3 folder will need to go within an S3 bucket configured for web hosting. This serves the front end HTML as well as the clientside javascript files required for collecting the form information and submitting the data to the API Gateway.
After the AWS SAM stack is deployed copy the API Gateway endpoint to update the ajax url in the /S3/includes/feedback.js file.
  1. Create an S3 bucket
  2. Name it exactly the same as the domain you will be directing to it (eg: feedback.mydomain.com)
  3. Configure it to serve as a website according to the following:
    1. http://docs.aws.amazon.com/gettingstarted/latest/swh/website-hosting-intro.html
  4. Upload S3 files to new bucket.
  5. Recommended: For security and performance an AWS CloudFront distribution should be created to cache your S3 bucket.
    1. https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/GettingStarted.SimpleDistribution.html

Credits

By no means did I come up with all of this by myself. I simply integrated the ideas from the three links found below::

Bootstrap Jquery form source:
http://myprogrammingblog.com/2013/08/27/how-to-make-a-contact-form-with-bootstrap-3-jqueryphphtml5jqbootstrapvalidation/

S3 Static Website Hosting:
http://docs.aws.amazon.com/gettingstarted/latest/swh/website-hosting-intro.html

Lambda/DynamoDB/API Gateway walk through:
http://docs.aws.amazon.com/apigateway/latest/developerguide/getting-started.html