7

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?

4

1 回答 1

9

写了一篇关于这个的博客文章。

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

  1. 你有你的 lambda 函数。盛大。
  2. 创建一个新的 Cognito 组。
  3. 授予未经身份验证的 Cognito 组权限以执行 lambda 函数。
  4. 在浏览器中将其全部连接起来。我在这里有一些示例代码...... https://github.com/chadbaudoin/lambda-twilio/blob/master/index.html

“困难”部分是确保 Cognito 组和 Lambda 函数的 IAM 设置都正确设置。我大量使用了本教程,但使用了 cognito 来执行,所以我没有暴露密钥。

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

于 2015-06-23T21:04:42.253 回答