简体   繁体   中英

How to convert AWS Lambda back into CloudFormation template

I have an AWS Lambda that was created by a Cloudformation template. Over the last couple of days I enhanced the function code. Now I would like to update the original function template with the updated Lambda code.

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.

One way to achieve this is using 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.
CDK will also achieve this concept.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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