Posted On: Nov 17, 2023

AWS CloudFormation launches a new parameter for the CreateChangeSet API called ImportExistingResources that streamlines the process of importing resources into stacks. When you deploy ChangeSets with the ImportExistingResources parameter, CloudFormation automatically imports the resources in your template that already exist in your AWS account. CloudFormation uses the custom names of resources in your template to determine their existence. With this launch, you can reduce the manual effort of import operations and avoid deployment failures because of naming conflicts.

ChangeSets allow you to preview the actions that CloudFormation will take in a deployment, such as resource creation. Today, you cannot create or modify resources and import resources with the same ChangeSet. This can delay deployments in which your template contains both existing and new resources, such as rollbacks. Further, to import resources, you must provide a document containing the unique name of each resource in addition to a template. This document allows you to import resources that do not accept custom names in templates, such as EC2 instances. However, creation of this document requires custom automation or manual effort. With ImportExistingResources, you can import resources with custom names within deployments that create or update stacks. You do not have to provide a separate document with resource names. This reduces manual steps and allows you to use CI/CD actions in scenarios where you only want to import resources with custom names.

ImportExistingResources is available in AWS Regions where CloudFormation is available. Refer to the AWS Region table to see AWS Regions where CloudFormation is available.

To learn more, see the CreateChangeSet API documentation