How can I resolve the "Export EXPORT_NAME cannot be updated as it is in use by STACK_NAME" error in AWS CloudFormation?
"I tried to update or delete my AWS CloudFormation stack, but I received an error similar to the following: "Export EXPORT_NAME cannot be updated as it is in use by STACK_NAME.""
"I tried to update or delete my AWS CloudFormation stack, but I received an error similar to the following: "Export EXPORT_NAME cannot be updated as it is in use by STACK_NAME."Short descriptionYou get this error when one or more stacks are importing an exported output value from the stack that you want to update or delete. You can't update or delete your stack when other stacks are importing values from your stack.To resolve this error, complete the following steps:Find the stacks that are importing the exported output value.For stacks that you identify as importing the exported value, update the stack template to replace the Importstatements with the actual output value.Update the importing stack using the modified template.ResolutionNote: If you receive errors when running AWS Command Line Interface (AWS CLI) commands, be sure that you’re using the most recent version of the AWS CLI.Find the stacks that are importing the exported output valueTo see what stacks are referencing the exported output value, use the AWS CLI, AWS Tools for PowerShell, or the AWS CloudFormation console.AWS CLI:1.    To list all exported output values, run the following command:aws cloudformation list-exports2.    To list all stacks that are importing an exported output value, run the following command:aws cloudformation list-imports --export-name EXPORT_NAMENote: Replace EXPORT_NAME with the name of your exported output value.AWS Tools for PowerShell:1.    To list all exported output values, run the following command:Get-CFNExport2.    To list all stacks that are importing an exported output value, run the following command:Get-CFNImportList -ExportName EXPORT_NAMENote: Replace EXPORT_NAME with the name of your exported output value.AWS CloudFormation console:1.    Open the AWS CloudFormation console.2.    From the CloudFormation menu, choose Exports.3.    For Export Name, choose the name of the exported output value from your stack.4.    For Imports, choose the stacks that are importing the exported output value from your stack.Update the stack template to replace the Import statements with the actual output value1.    In your AWS CloudFormation template, replace intrinsic functions with the imported values for every stack that references the exported output value of your stack.For example, the intrinsic functions Fn::ImportValue and !ImportValue are both replaced with the imported value arn:aws:s3:::sample in the following JSON and YAML templates.JSON template with intrinsic function:{    "Parameters": {       "parameterName": {          "Type": "String"       }    },    "Resources": {       "testParameter": {          "Type": "AWS::SSM::Parameter",          "Properties": {             "Description": "Test SSM Parameter",             "Name": { "Ref": "parameterName" },             "Type": "String",             "Value": { "Fn::ImportValue": "sample-s3-bucket:Bucket-arn" }          }       }    } }JSON template with imported value:{    "Parameters": {       "parameterName": {          "Type": "String"       }    },    "Resources": {       "testParameter": {          "Type": "AWS::SSM::Parameter",          "Properties": {             "Description": "Test SSM Parameter",             "Name": { "Ref": "parameterName" },             "Type": "String",             "Value": "arn:aws:s3:::sample"          }       }    } }YAML template with intrinsic function:Parameters:  parameterName:    Type: StringResources:  testParameter:    Type: AWS::SSM::Parameter    Properties:      Description: Test SSM Parameter      Name: !Ref parameterName      Type: String      Value: !ImportValue sample-s3-bucket:Bucket-arnYAML template with imported value:Parameters:  parameterName:    Type: StringResources:  testParameter:    Type: AWS::SSM::Parameter    Properties:      Description: Test SSM Parameter      Name: !Ref parameterName      Type: String      Value: arn:aws:s3:::sample2.    Update or delete your stack.Now that the imports are disassociated, you can update or delete the stack that exported the values.Related informationListing stacks that import an exported output valuelist-exportslist-importsGet-CFNExport CmdletGet-CFNImportList CmdletFollow"