Hleb
Hleb

Reputation: 7371

Export existing AWS Lambda and API Gateway to Cloudformation template

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?

Upvotes: 28

Views: 13740

Answers (3)

smg
smg

Reputation: 1223

Former2 seems to be the most recent way to accomplish this, and supports most AWS services. AWS blog post on it here.

Former2 allows you to generate Infrastructure-as-Code outputs from your existing resources within your AWS account. By making the relevant calls using the AWS JavaScript SDK, Former2 will scan across your infrastructure and present you with the list of resources for you to choose which to generate outputs for.

I just used it to export API Gateway and DynamoDB infra to a CloudFormation template.

Upvotes: 1

Hleb
Hleb

Reputation: 7371

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.

Upvotes: 21

Loaf
Loaf

Reputation: 3260

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.

Upvotes: 0

Related Questions