Project Reasoning

The reasoning behind this project was to utilise the technical skills I have gained up until this point to architect an application that makes use of APIs, DynamoDB, S3, Lambda, SNS and Cloudwatch for debugging. I was aware that this project contained several moving parts and wanted to use this as an opportunity to challenge myself.

Project Aim

The aim of this project was to create a front end application where users can submit their credentials (Name, Email, and Message), which would trigger a lambda function and store the credentials to a database. A notification was then sent to notify the administrator that a new applicant had signed up. The idea was to store several inspirational quotes and send and random quote at a specific time per day to each user.

Setting up the Environment

I began this project by first deploying a Node.js template express API with DynamoDB. This set up the barebones infrastructure needed for this application. Permission was also given to S3 to access the json file contain the random quotes.

Get Quotes API End Point

The purpose of this file was to gain access to the stored quotes by calling the bucket name and the key “quotes.json” and parse through the file.  I allowed for error handling by displaying the body of the file or displaying an issue if there was a server error. I tested the functionality by deploying the function and running a GET request using Postman.

Subscriber API End Point

The purpose of this function was to append the newly added user to a DynamoDB table. A parameters variable was used to format the items stored within the table as key value pairs. For example:

userId: uuid.v4() (Imported Module),

email: data.email,

subscriber: true,

createdAt: timestamp,

updatedAt: timestamp,

I then deployed this function to AWS and tested the API using Postman by creating a post request. Like with the GetQuotes endpoint I allowed for error handling to ensure the API was working. I was then able to check this further by looking at the table created in DynamoDB.

Get Subscriber API

The next API that needed to be created was one to get. This was a fairly basic function which scans the parameters within the DynamoDB table and returns the contents in a JSON format. This was deployed to AWS and test was run using Postman to make sure everything was working.

Static Mailer API Endpoint

The purpose of this function was to publish an SNS message each time a new subscriber signs up via the Endpoint. The axios network library was required for this to work as it allowed data to be fetched from an API. The core functionality of subscribing the user was already created in within the subscriber endpoint, however this staticmaler allows the subscribers message to be read from the form on the front end.

Front End

To create the front end for this project, I deployed an existing template using Next.js. The form contains a “send” button which has an event trigger attached which triggers the StaticMailer function to post the contents of the form. Error handling was used to identify any errors and since I no longer needed to use an API URL, I was able to use the inspector console to identify potential issues. To verify this worked I checked Dynamo DB as well as the administration email attached to the SNS topic.

Send Email API

The next stage of development involved retrieving the quotes and sending a random one to subscriber. To do this I used the SendGrid API service, as it was straight forward to install and the free version allows an ample amount of emails to be sent, which was suitable for this project. It provided me with an API key which I added to my YAML file. A Send Email function was then created accesses both the “Get Quotes” and “Get Subscribers” function and passes this to the “SendGrid API”. HTML email is used to format the messages sent to the subscribers by using the following:

to: subs,

from: "alcloud2022@gmail.com",

subject: `[Daily Words of Wisdom]`,

text: "Get Inspired Today",

html: emailHTML,

To automate this process, I set up a schedule within the YAML folder to send an email out each day at 1pm.

Send Email API

The next stage of development involved retrieving the quotes and sending a random one to subscriber. To do this I used the SendGrid API service, as it was straight forward to install and the free version allows an ample amount of emails to be sent, which was suitable for this project. It provided me with an API key which I added to my YAML file. A Send Email function was then created accesses both the “Get Quotes” and “Get Subscribers” function and passes this to the “SendGrid API”. HTML email is used to format the messages sent to the subscribers by using the following:

to: subs,

from: "alcloud2022@gmail.com",

subject: `[Daily Words of Wisdom]`,

text: "Get Inspired Today",

html: emailHTML,

To automate this process, I set up a schedule within the YAML folder to send an email out each day at 1pm.

Project Ref

Project Reflection

This project has given me a strong understanding of serverless technology and just how powerful it is within the realm of cloud computing. I definitely did face some challenges throughout, from small syntactical errors to invoking issues. However I was able to use existing code solutions in some areas as well as well as help forums to rectify the problems. If I was to carry out this project again I would make it more production ready by adding validation checks, running more tests and writing more efficient code. However, I am definitely satisfied with the outcome of the overall project.