本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
步骤 2:执行与 SNS 关联的示例应用程序
-
在 Amazon Lambda 控制台中的导航面板上,选择 Applications (应用程序)。
-
在 Applications (应用程序) 页面上的搜索字段中,搜索
serverlessrepo-fork-example-ecommerce-,然后选择该应用程序。my-app -
在 Resources (资源) 部分中,执行以下操作:
-
要查找其类型为 ApiGateway RestApi 的资源,请按 Type (类型)(例如,
ServerlessRestApi)为资源分类,然后展开资源。 -
将显示类型为 ApiGateway Deployment (ApiGateway 部署) 和 ApiGateway Stage (ApiGateway 阶段) 的两个嵌套资源。
-
复制链接 Prod API endpoint (Prod API 终端节点) 并为其附加
/checkout,例如:https://abcdefghij.execute-api.us-east-2.amazonaws.com/Prod/checkout
-
-
将以下 JSON 复制到名为
test_event.json的文件中。{ "id": 15311, "date": "2019-03-25T23:41:11-08:00", "status": "confirmed", "customer": { "id": 65144, "quantity": 2, "price": 25.00, "subtotal": 50.00 }] } -
要将 HTTPS 请求发送到您的 API 端点,请通过执行
curl命令来将示例事件负载作为输入传递,例如:curl -d "$(cat test_event.json)" https://abcdefghij.execute-api.us-east-2.amazonaws.com/Prod/checkoutAPI 将返回以下空响应,并指示已成功执行:
{ }