【问题标题】:Using the aws-cdk-local package and Localstack to test Lambda and APIGateway使用 aws-cdk-local 包和 Localstack 测试 Lambda 和 APIGateway
【发布时间】:2021-09-20 13:03:27
【问题描述】:

谁能告诉我如何执行以下操作。

我创建了一个具有 API 网关和 Lambda 函数的云开发工具包应用程序

我想使用 aws-cdk-local 包和 Localstack 在本地进行测试

我已经正确安装了所有东西,我可以将我的 CDK 应用程序部署到 Localstack

如何让端点测试 APIGateway。我在使用 cdklocal deploy 后在控制台中看到的端点不正确 使用类似 http://localhost:4566/restapis/my-api-gateway-id/dev/ 的结果

<Error>
<Code>NoSuchBucket</Code>
<Message>The specified bucket does not exist</Message>
<BucketName>restapis</BucketName>
<RequestId>xxxxx-xxxx-xxxx-xxxx-6e8eEXAMPLE</RequestId>
</Error>

欢迎任何有关如何创建正确端点的建议或 cmets。

【问题讨论】:

    标签: aws-cdk localstack


    【解决方案1】:

    对于其他人来说,下面的网址似乎有效

    http://localhost:4566/restapis/restapi-id/local/_user_request_/
    

    指出端口 4566 是我的 localstack 运行的端口。

    使用

    aws --endpoint-url=http://localhost:4566 apigateway get-rest-apis
    

    获取restapi id

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-12-09
      • 2020-02-04
      • 2017-01-07
      • 2021-05-15
      • 2022-09-29
      • 2018-09-30
      • 2019-12-06
      • 1970-01-01
      相关资源
      最近更新 更多