我需要创建一个集成项目,在执行时,它应该启动所有aws模拟服务,如S3、API网关、SQS、Dynamo 和SSM。我们使用serverless.com框架在Node.js中开发在内部使用上述AWS服务的lambda。此外,这些lambda使用API网关调用另一个lambda,其中X调用类型是异步调用的事件。
对于在本地运行这些lambda,我应该选择哪种方法的任何建议:
因此,当该项目被执行时,它将在本地机器中的特定端口上运行这些服务。
- For this i need to write a sam template as currently i have used serverless.com framework where there is serverless.yml rather than sam template.
- There is also serverless-sam plugin to export the serverless.yml to sam template, However, it throws an error for few parts in serverless.yml as for few infra build we use the output of terraform execution in serverless.yml.
- This terraform is not available for local. So basically i dont have option to use export feature of serverless-sam plugin. I would need to create a separate project that will have sam template containing specification of all dependent AWS service.
提前感谢
发布于 2020-04-07 06:19:58
这听起来是局部堆栈的一个很好的用法
Local堆栈将生成一个本地Docker实例,该实例可以充当本地AWS端点,并支持大量服务和功能。
积极方面:
底片:
(请参阅此代码作为示例,其中Lambda运行在自己的Docker容器中,但需要在测试期间访问脱机EC2实例:lambda.py#L55)
完全披露:我是一个Moto合作者,这是使用的地方堆栈下的引擎盖。
https://stackoverflow.com/questions/60703916
复制相似问题