简体   繁体   English

用 cloudformation 替换 terraform 部署的 lambda

[英]Replacing a terraform deployed lambda in place with cloudformation

I've got a requirement to move from our existing terraform/gocd deployment structure for our lambdas to using codepipeline and cloudformation.我需要从我们现有的用于 lambda 的 terraform/gocd 部署结构转移到使用 codepipeline 和 cloudformation。

The main obstacle I've hit is cloudformation can't deploy a lambda with an existing name meaning I currently need to delete the existing lambda, for our test environment and lesser used lambdas not a huge problem but there are a few critical ones I'd rather have a cleaner way of moving across, is there a way to replace it in place?我遇到的主要障碍是 cloudformation 无法部署具有现有名称的 lambda,这意味着我目前需要删除现有的 lambda,对于我们的测试环境和较少使用的 lambda 不是一个大问题,但有一些关键的我宁愿有一种更清洁的移动方式,有没有办法将其替换到位?

The only way is to import existing resources to CloudFormation.唯一的方法是将现有资源导入CloudFormation。 Please note that not all resources can be imported.请注意,并非所有资源都可以导入。 The list of supported ones is here .支持的列表在这里

In terms of lambda, the following resources can be imported: lambda方面,可以导入以下资源:

  • AWS::Lambda::Alias AWS::Lambda::别名
  • AWS::Lambda::CodeSigningConfig AWS::Lambda::CodeSigningConfig
  • AWS::Lambda::Function AWS::Lambda::Function
  • AWS::Lambda::Version AWS::Lambda::版本

However, importing procedure is not that straightforward.但是,导入过程并不是那么简单。 For it to work you already need to have proper templates which match the existing resources .要使其正常工作,您已经需要拥有与现有资源相匹配的适当模板。

Thus its better to do some practice runs on test functions and other resources to get familiar with the process and its requirements, before you attempt using production functions.因此,在尝试使用生产功能之前,最好在测试功能和其他资源上进行一些练习,以熟悉流程及其要求。 Also, you can consider using former2 to help you with generation of these initial templates from existing lambda as a starting point.此外,您可以考虑使用former2来帮助您从现有的lambda 作为起点生成这些初始模板。

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

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