简体   繁体   English

使用 AWS CDK Python 创建/部署多个 Lambda 函数

[英]Create/Deploy multiple Lambda functions using AWS CDK Python

I have a scenario that need to create a multiple lambda functions using AWS CDK python language.我有一个场景需要使用 AWS CDK python 语言创建多个 lambda 函数。

As I have tried to create multiple stacks for each function, It's created first function and rest of the functions showing that function already existed. As I have tried to create multiple stacks for each function, It's created first function and rest of the functions showing that function already existed.

if we debug the cdk.out for created templates that two stacks Lambda function showing same Resource ID like below:如果我们为创建的模板调试 cdk.out,两个堆栈 Lambda function 显示相同的资源 ID,如下所示:

"Resources": {
"LambdaFunctionBF21E41F": {
  "Type": "AWS::Lambda::Function",
  "Properties": {
    "Code": {

How to get unique IDs for the resources to create multiple functions?如何获取资源的唯一 ID 以创建多个功能? Could you please suggest how to overcome this?你能建议如何克服这个问题吗? I want to create multiple lambda functions even if the solution is from creating loop is also fine and我想创建多个 lambda 函数,即使解决方案是从创建循环也可以

Early response would be much appreciated.早期反应将不胜感激。 Thanks in advance提前致谢

Regards, Pavan kumar D问候, Pavan kumar D

Create multiple lambda functions using the aws_lambda module function method as many as required.Add the function stack with respect to stack class to app.py file. Create multiple lambda functions using the aws_lambda module function method as many as required.Add the function stack with respect to stack class to app.py file. Now when you run cdk diff/synth you can see creating functions in template(cdk.out)/console现在,当您运行 cdk diff/synth 时,您可以看到在 template(cdk.out)/console 中创建函数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM