How do I resolve the "No Export named XYZ found" error in CloudFormation?
I receive the "No Export named XYZ found" error in AWS CloudFormation when I use Fn::ImportValue in my stack.
"I receive the "No Export named XYZ found" error in AWS CloudFormation when I use Fn::ImportValue in my stack.Short descriptionIf you create a stack reference in CloudFormation that uses import or export values, then you must do the following:In the stack where you're exporting a value, use the Export: flag in the Outputs section of your CloudFormation template.In the stack where you want to reference the exported value, use Fn::ImportValue.You can receive the "No Export named XYX found" error in the following scenarios:You're using Fn::ImportValue in nested stacks.The exported value isn't in the same AWS Region or same AWS account where you're importing the value.The exported value isn't created or published before the stack imports it.You used an incorrect export name in the importing stack.Choose one of the following resolutions based on the scenario that you're experiencing.ResolutionNote: If you receive errors when running AWS Command Line Interface (AWS CLI) commands, make sure that you’re using the most recent AWS CLI version.You're using Fn::ImportValue in nested stacksBy default, CloudFormation creates child stacks in parallel with nested stacks. If child stacks are created in parallel with each other and one is importing an output from another other, then stack creation can fail. The export value is at risk of not being available in time to be imported by the other child stack.To resolve this issue, use the DependsOn attribute to create an explicit dependency for the stack that's using Fn::ImportValue. The child stack that's using Fn:ImportValue is then created only after the child stack that exports the value.In the following example nested stack, ChildStack01 exports a value in the Outputs section, and ChildStack02 uses Fn::ImportValue to import the value from ChildStack01. You can use DependsOn for ChildStack02 based on the following example YAML template:AWSTemplateFormatVersion: 2010-09-09Resources: ChildStack01:   Type: 'AWS::CloudFormation::Stack'   Properties:     TemplateURL: 'https://s3.amazonaws.com/cloudformation-templates-us-east-1/VPC.template'     TimeoutInMinutes: '60' ChildStack02:   Type: 'AWS::CloudFormation::Stack'   DependsOn: ChildStack01   Properties:     TemplateURL: 'https://s3.amazonaws.com/cloudformation-templates-us-east-1/Subnet.template'     TimeoutInMinutes: '60'Tip: For cross-stack references, use Fn::ImportValue to import a value from another template. For nested stacks, use Fn::Ref and Fn::GetAtt to reference the value in your current template.The exported value isn't in the same AWS Region or same AWS account where you're importing the valueCross-stack references apply only within a single account and Region. Other stacks that are in the same account and Region can import only the exported values.To resolve this issue, complete the steps in the Verify the stack configuration of the export and import stacks section before you create the stack with Fn::ImportValue.The exported value isn't created or published before the stack imports itFor non-nested stacks, you must deploy the stack that's exporting a value. The stack must be in the Create_Complete or Update_Complete state before creating the stack that's being imported.To resolve this issue, complete the steps in the Verify the stack configuration of the export and import stacks section before you create the stack with Fn::ImportValue.You used the incorrect export name in the importing stackConfirm that the export name is listed in your account.When you import an export name from one stack to another stack, confirm that you're using the exact same export name in both stacks.Complete the steps in the Verify the stack configuration of the export and import stacks section before you create the stack with Fn::ImportValue.Verify the stack configuration of the export and import stacksYou can use either the CloudFormation console or the AWS CLI to verify that the export value exists in the same Region and account.Using the CloudFormation console:Open the CloudFormation console.From the navigation pane, choose Exports.Confirm that the export value is listed in the console.Using the AWS CLI:1.    To list the available exports, run the following command:aws cloudformation list-exports --region us-east-1Note: Replace us-east-1 with your Region.2.    In the output, verify that the Name property is the same for both the importing and exporting stack. The output is similar to the following:aws cloudformation list-exports --region us-east-1 --output yamlExports:- ExportingStackId: arn:aws:cloudformation:us-east-1:123456789012:stack/private-vpc/99764070-b56c-xmpl-bee8-062a88d1d800  Name: private-vpc-subnet-a  Value: subnet-01a234bcdefghij56Important: When you use import and export values in your stacks, consider the following: After a stack imports an output value, you can't delete the stack that's exporting the output value or modify the exported output value. You must remove all the imports before you can delete the exporting stack or modify the output value. The export name must be unique within the Region. As a workaround, you can use parameters in AWS Systems Manager Parameter Store to share values between CloudFormation stacks.Follow"