19
votes

How to export existing configured and tested infrastructure (including AWS Lambda functions, API Gateways, ElastiCache clusters, Cloudwatch rules) to Cloudformation template?

I know about Cloudformer tool, but it supports limited number of AWS services (Amazon VPC, DynamoDB, etc) and don't supports some of services which we use. Which tools and approaches can I use in my case for generating Cloudformation template?

2
Out of my experience it makes more sense to write everything from scratch without having a tool which is doing reverse engineering. For sure it means you need to spend much more time but on the other hand you are able to re-think (and understand) your whole infrastructure.MaiKaY
Yeah, the main cause why I'm looking for ways to export existing resources is to save timeGleb

2 Answers

17
votes

Partial solution: there is ability to export Lambda function to AWS SAM file

enter image description here

and then

enter image description here

We will get YAML file which describes your Lambda function as 'AWS::Serverless::Function'. But there are few things - we can't export Lambda aliases with such approach. Also that doesn't help with API Gateway exporting.

0
votes

CloudFormer was built for this, however, I agree with @MaiKaY that you should rewrite everything. CloudFormer will create hard-links with IDs, where you have to replace these with references, add parameters and/or mappings. It can help you get started, so you know what you need in the template.