How do I resolve the "This template does not include any resources to import" error in AWS CloudFormation?

Last updated: 2021-02-17

I receive the following error in the AWS CloudFormation console: "This template does not include any resources to import. Learn more."

Short description

You receive this error when you use the AWS CloudFormation console to import resources that are created outside of AWS CloudFormation into an existing stack.

This error can occur when you use the AWS CloudFormation console in scenarios with any of the following:

  • Conditional resources. You have an AWS CloudFormation template that excludes conditional resources, or resources that haven’t met certain conditions. You make adjustments to the resources, so that the conditions are met. Then, you update your template to include the resources now that the conditions are met. However, the AWS CloudFormation console, which uses the GetTemplateSummary API to gather imported resources and their identifiers, doesn’t recognize if the conditions are met in your updated template.
  • AWS Serverless Application Model (AWS SAM) templates. AWS SAM templates don't support the ability to import resources that use the AWS::Serverless transform.
  • Fn::Transform. The AWS CloudFormation console doesn't support the use of the intrinsic function Fn::Transform for stack updates that use a template to import resources.

To resolve this error, you can use the AWS Command Line Interface (AWS CLI) instead of the AWS CloudFormation console. Use the AWS CLI only if the import doesn't affect resources that use the Fn::Transform function or AWS::Serverless resources directly.

The AWS CLI doesn't use GetTemplateSummary to retrieve identifiers for imported resources. Instead, the AWS CLI requires you to explicitly provide imported resources using the AWS CloudFormation API create-change-set or execute-change-set.

Note: If you receive errors when running AWS CLI commands, make sure that you’re using the most recent AWS CLI version.


In the following scenario, an Amazon Elastic Container Service (Amazon ECS) cluster is imported into an AWS CloudFormation stack:

    Type: AWS::ECS::Cluster
    DeletionPolicy: Retain
      ClusterName: Cluster2

To resolve the error in the preceding scenario, complete the following steps:

Note: If your stack isn't in your default AWS Region, then add --region to your commands, or change the default Region by setting and exporting the AWS_DEFAULT_REGION environment variable.

1.    Create a resource import file called import.txt. For example:

        "ResourceType": "AWS::ECS::Cluster",
        "ResourceIdentifier": {

2.    To create a change set against your stack, run the following command:

ID=$(aws cloudformation create-change-set --stack-name testStack --change-set-name testSet --resources-to-import file://import.txt --change-set-type IMPORT --template-body file://template.yaml --capabilities CAPABILITY_AUTO_EXPAND  --query 'Id' --output text)

Note: The preceding command returns the Amazon Resource Name (ARN) of the change set and stores the ARN in the environment variable ID. Replace testStack with your stack name and template.yaml with your AWS CloudFormation template file name.

3.    (Optional) To wait for the change set to be created successfully, run the following command:

aws cloudformation wait change-set-create-complete --change-set-name=${ID}

4.    To apply the change set and import your resource into the stack, run the following command:

aws cloudformation execute-change-set --change-set-name ${ID}

Note: You must use CAPABILITY_AUTO_EXPAND only if your template uses transformations.

5.    (Optional) To verify that all properties in your template match with your resource, use drift detection on the resource.