Input on AWS-driven form field
Advanced form-field solution architecture hosted by AWS
Hi fellow #AWS builders - question for you! I’m looking to build a serverless form-field email capture. I’ve drafted the included design, with the intended design and will be written in AWS #CDK (#Python). Albeit a bit overkill for its purpose, isn’t that the nature of a hobby project?! ;)
- Client enters the site, enters their email to be informed of upcoming events, etc. This is a SPA (single-page application) hosted by Amazon CloudFront, serving Amazon S3 as the origin. For those concerned, don’t worry, there is a CAPTCHA to ensure I don’t get spammed to the other side of the world.
- The onClick event on the form execute’s POST to the API endpoint hosted within the API Gateway endpoint as defined in step
- Once validated (TBD - API Key? Need security and obfuscation of the key), the event payload is sent to the queue. CORS ensures it’s being submitted through the originating site.
-
The event source mapping defines the Lambda function to process messages in the queue. This may be unneeded due to perceived incoming load, but I’m all for simple (and cheap) fail-safes that will mitigate load.
-
The Lambda function reads the batch, extracts the necessary information (it’s simple, the email address.. which will be validated on input and re-validated in the function).
-
The function uses put_item() to place the item in the DynamoDB table with the necessary partition key (that serves a whole other conversation.. but likely a UUID) and a long-lived TTL. This is used simply for future reference to scrape and send those interested necessary info in the future.
-
The function also calls Amazon SES w/ a trusted domain to ready the send of a confirmation of the request, etc. That is the extent of the request, it doesn’t need to look pretty per-say.
-
SES ships the email from noreply@xyz.com from the trusted domain with the necessary details.
Is this the best way to approach this? Is there any AWS CDK patterns that you’re familiar with that you’re interested in sharing? Is there simpler hosted form-fields that I should be using (that reminds me of the old-days.. cgi-bin & #Perl anyone)?