从表单帖子触发AWS Lambda [英] Triggering a AWS Lambda from a form post

查看:87
本文介绍了从表单帖子触发AWS Lambda的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个使用SES发送电子邮件的小型AWS Lambda。我正在寻找联系我们从静态网站到这个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.

是否可以将联系我们表格直接发布到lambda的网址上?我没有使用服务器端框架,我真的想避免它,我有什么选择?是否有客户端Javascript方式来调用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?

推荐答案

写了一篇关于此事的博文。

这完全可行。这是使用AWS Cognito来调用该函数的问题。

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


  1. 你有lambda函数。 Grand。

  2. 创建一个新的Cognito组。

  3. 授予unauth'ed Cognito组执行lambda函数的权限。

  4. 在浏览器中连接所有内容。我这里有一些示例代码...
    https://github.com/chadbaudoin/lambda -twilio / blob / master / index.html

  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.com/chadbaudoin/lambda-twilio/blob/master/index.html

硬部分确保IAM设置为Cognito组和Lambda函数都已正确设置。我使用了这个教程,但是使用了cognito来执行,所以我没有公开键。

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

这篇关于从表单帖子触发AWS Lambda的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆