最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Triggering a AWS Lambda from a form post - Stack Overflow

programmeradmin0浏览0评论

I've created a small AWS Lambda that sends an email using SES. I'm looking to hookup a contact us form from a static website to this lambda.

Is it possible to have the contact us form post directly to a url of the lambda? I'm not using a server side framework and would really like to avoid it, what are my options? Is there client side Javascript way to invoke the lambda?

I've created a small AWS Lambda that sends an email using SES. I'm looking to hookup a contact us form from a static website to this lambda.

Is it possible to have the contact us form post directly to a url of the lambda? I'm not using a server side framework and would really like to avoid it, what are my options? Is there client side Javascript way to invoke the lambda?

Share Improve this question asked Jun 23, 2015 at 19:59 MikebMikeb 7917 silver badges25 bronze badges 1
  • Adding cloudfront as a proxy in order to use the same origin is another alternative to CORS: codeengine./articles/process-form-aws-api-gateway-lambda – Dave Maple Commented Jan 6, 2017 at 14:56
Add a ment  | 

1 Answer 1

Reset to default 9

Wrote a blog post about this.

This is totally doable. It's a matter of using AWS Cognito to call that function.

  1. You have your lambda function in place. Grand.
  2. Create a new Cognito group.
  3. Give the unauth'ed Cognito group permissions to execute the lambda function.
  4. Wire it all up in the browser. I have some example code here… https://github./chadbaudoin/lambda-twilio/blob/master/index.html

The “hard” part is making sure that the IAM settings for the Cognito group and the Lambda function are all set up correctly. I used this tutorial pretty heavily, but used cognito to execute so I wasn't exposing keys.

http://lg.io/2015/05/16/the-future-is-now-and-its-using-aws-lambda.html

发布评论

评论列表(0)

  1. 暂无评论