Generate templates from existing resources with IaC generator - AWS CloudFormation

Generate templates from existing resources with IaC generator

With the CloudFormation infrastructure as code generator (IaC generator), you can generate a template using AWS resources provisioned in your account that are not already managed by CloudFormation.

The following are benefits of the IaC generator:

  • Bring entire applications under CloudFormation management or migrate them into an AWS CDK app.

  • Generate templates without having to describe a resource property by property and then translate that into JSON or YAML syntax.

  • Use the template to replicate resources in a new account or Region.

The IaC generation process consists of the following steps:

  1. Scan resources – The first step is to start a scan of your resources. This scan is region-wide and lasts for 30 days. During this time, you can create multiple templates from the same scan.

  2. Create your template – To create the template, you have two options:

    • Create a new template from scratch and add the scanned resources and related resources to it.

    • Use an existing CloudFormation stack as a starting point and add the scanned resources and related resources to its template.

  3. Import resources – Use your template to import the resources as a CloudFormation stack or migrate them into an AWS CDK app.

The IaC generator feature is available in all commercial Regions and supports many common AWS resource types. For a full list, see Resource type support.

Considerations

You can generate JSON or YAML templates for AWS resources published to the CloudFormation registry, for resources for which you have Read permissions. The templates for the IaC generator capability models cloud resources reliably and quickly without having to describe a resource property by property.

The following table lists the quotas available for the IaC generation feature.

Name Value

Maximum number of resources that can be processed in an account scan

100000

Number of scans per day (for accounts with less than 10,000 resources)

3

Number of scans per day (for accounts with more than 10,000 resources)

1

Concurrent number of templates generating per account

5

Concurrent number of resources modeled for one template generation.

5

Total number of resources that can be modeled in one template

500

Maximum number of generated templates per account

1,000

Important

IaC generator only supports resources that are supported by Cloud Control API in your Region. For more information, see Determining if a resource type supports Cloud Control API in the Cloud Control API User Guide

Commonly used commands for template generation, management, and deletion

The commonly used commands for working with IaC generator include:

Migrate a template to the AWS CDK

The AWS Cloud Development Kit (AWS CDK) is an open-source software development framework that you can use to develop, manage, and deploy CloudFormation resources using popular programming languages.

The AWS CDK CLI provides an integration with IaC generator. Use the AWS CDK CLI cdk migrate command to convert the CloudFormation template and create a new CDK app that contains your resources. Then, you can use the AWS CDK to manage your resources and deploy to CloudFormation.

For more information, see Migrate to AWS CDK in the AWS Cloud Development Kit (AWS CDK) Developer Guide.