简体   繁体   English

如何将 AWS Lambda 转换回 CloudFormation 模板

[英]How to convert AWS Lambda back into CloudFormation template

I have an AWS Lambda that was created by a Cloudformation template.我有一个由 Cloudformation 模板创建的 AWS Lambda。 Over the last couple of days I enhanced the function code.在过去的几天里,我增强了 function 代码。 Now I would like to update the original function template with the updated Lambda code.现在我想用更新的 Lambda 代码更新原始的 function 模板。

What's the best way to achieve this?实现这一目标的最佳方法是什么?

I'd like to avoid having to manually convert the Lambda python code to yaml or json as this will be too time consuming and error prone, anticipating that there will be fixes to the code over the next few weeks. I'd like to avoid having to manually convert the Lambda python code to yaml or json as this will be too time consuming and error prone, anticipating that there will be fixes to the code over the next few weeks.

One way to achieve this is using SAM https://aws.amazon.com/serverless/sam/ .实现此目的的一种方法是使用 SAM https://aws.amazon.com/serverless/sam/
This way you will always be able to package your lambdas in your cloudformation template before it's deployed.这样,您将始终能够在部署之前在 cloudformation 模板中 package 您的 lambdas。
CDK will also achieve this concept. CDK也将实现这个概念。

If this is only a one time thing you want to do, you don't really need to change anything in that lambda, you would just copy the code and paste it in your CloudFormation template as an inline code as so: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html如果这只是您想做的一次性事情,您实际上不需要更改 lambda 中的任何内容,您只需复制代码并将其作为内联代码粘贴到 CloudFormation 模板中,如下所示: https:// docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html

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

相关问题 如何将 AWS 资源转换为 cloudformation 堆栈或模板? - How to convert AWS resources to a cloudformation stack or template? 如何将 AWS CloudWatch 仪表板转换为 CloudFormation 模板 - How to convert AWS ClouldWatch Dashboard into CloudFormation template 如何在Cloudformation模板中为AWS Lambda定义MetricFilter? - How to define MetricFilter for AWS Lambda inside Cloudformation template? 如何为使用 CloudFormation 模板创建的 AWS Lambda function 添加触发器? - How to add triggers for a AWS Lambda function created using a CloudFormation template? 如何在CloudFormation模板中描述AWS Lambda函数测试事件? - How to describe AWS Lambda function test events in CloudFormation template? 如何使用 CloudFormation 模板更新 AWS Lambda function - How do I update AWS Lambda function using CloudFormation template 将 AWS CloudFormation 转换为 Terraform 模板 - Convert AWS CloudFormation to Terraform template 通过Cloudformation模板将Lambda目标与AWS ALB - AWS ALB with lambda target through Cloudformation Template AWS SAM/CloudFormation 模板 Lambda 删除保护 - AWS SAM/CloudFormation Template Lambda Delete Protection 如何使用cloudformation模板传递aws-lambda函数名称以生成cloudwatch警报 - How to pass aws-lambda function name to generate a cloudwatch alarm using cloudformation template
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM