步骤 2:执行示例应用程序 - Amazon Simple Notification Service
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

步骤 2:执行示例应用程序

  1. 在 Amazon Lambda 控制台中的导航面板上,选择 Applications (应用程序)

  2. Applications (应用程序) 页面上的搜索字段中,搜索 serverlessrepo-fork-example-ecommerce-my-app,然后选择该应用程序。

  3. Resources (资源) 部分中,执行以下操作:

    1. 例如,要查找类型为的资源 ApiGatewayRestApi,请按类型对资源进行排序ServerlessRestApi,然后展开该资源。

    2. 将显示两个嵌套资源,分别是 “ApiGateway部署” 和 “ApiGateway阶段”。

    3. 复制链接 Prod API endpoint (Prod API 终端节点) 并为其附加 /checkout,例如:

      https://abcdefghij.execute-api.us-east-2.amazonaws.com/Prod/checkout
  4. 将以下 JSON 复制到名为 test_event.json 的文件中。

    { "id": 15311, "date": "2019-03-25T23:41:11-08:00", "status": "confirmed", "customer": { "id": 65144, "name": "John Doe", "email": "john.doe@example.com" }, "payment": { "id": 2509, "amount": 450.00, "currency": "usd", "method": "credit", "card-network": "visa", "card-number": "1234 5678 9012 3456", "card-expiry": "10/2022", "card-owner": "John Doe", "card-cvv": "123" }, "shipping": { "id": 7600, "time": 2, "unit": "days", "method": "courier" }, "items": [{ "id": 6512, "product": 8711, "name": "Hockey Jersey - Large", "quantity": 1, "price": 400.00, "subtotal": 400.00 }, { "id": 9954, "product": 7600, "name": "Hockey Puck", "quantity": 2, "price": 25.00, "subtotal": 50.00 }] }
  5. 要将 HTTPS 请求发送到您的 API 终端节点,请通过执行 curl 命令来将示例事件负载作为输入传递,例如:

    curl -d "$(cat test_event.json)" https://abcdefghij.execute-api.us-east-2.amazonaws.com/Prod/checkout

    API 将返回以下空响应,并指示已成功执行:

    { }