This post will show you how to save messages from a public endpoint to your backend using AWS Lambda, AWS S3 and Google Recaptcha.

Wrote the GIST for myself but I had enough requests to share it in a blog post. Copy/paste what you want.

Request from a frontend source

Add this to the frontend index.html (or anywhere a form will be sent from). Replace the _reCAPTCHA_site_key with a real one.

<script src=""></script>
  grecaptcha.ready(function() {
      grecaptcha.execute('_reCAPTCHA_site_key_', {action: 'homepage'}).then(function(token) {


Backend Setup

Start by creating an AWS Lambda function that has access to add items to S3. Using a node.js/javascript lambda function.

Environment Keys:

API Gateway Setup

  • Create an AWS API Gateway API with a resource form with a method POST.
  • Integration type Lambda Function
  • Use Lambda Proxy integration: checked
  • Select Lambda function