[英]Create an api in api gateway to invoke a lambda function
I am working on a project and trying to use API Gateway to invoke a lambda function.我正在做一个项目并尝试使用 API 网关来调用 lambda function。 The lambda function is used to update a DynamoDB item.
lambda function 用于更新 DynamoDB 项目。 The DynamoDB table is used to keep a running count of visitors to a web page.
DynamoDB 表用于保持对 web 页面的访问者的运行计数。 I need to create an API to invoke the lambda function but I'm not sure how to create the API.
我需要创建一个 API 来调用 lambda function 但我不知道如何创建 ZDB4644238D084CADE1 Any assistance is appreciated.
任何帮助表示赞赏。
General steps would be:一般步骤是:
Create AWS_PROXY integration between API Gateway and your Lambda function.在 API 网关和您的 Lambda function 之间创建AWS_PROXY集成。 The example of this is in the AWS tutorials: Set up Lambda proxy integrations in API Gatewa and in Tutorial: Build a REST API with HTTP proxy integration
The example of this is in the AWS tutorials: Set up Lambda proxy integrations in API Gatewa and in Tutorial: Build a REST API with HTTP proxy integration
Add/amend execution role to your function allowing it to access DynamoDB.向您的 function 添加/修改执行角色,使其能够访问 DynamoDB。 This is exemplified in the AWS tutorial: Using AWS Lambda with Amazon DynamoDB .
这在 AWS 教程中得到了例证:将 AWS Lambda 与 Amazon DynamoDB 一起使用。
Test the API .测试 API 。 It can be done directly in API gateway console, or using external tools such as
curl
or Postman
.可以直接在 API 网关控制台中完成,也可以使用
curl
或Postman
等外部工具完成。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.