Bobcares

AWS EXPORT_NAME cannot be updated

by | Oct 29, 2021

Most often, we come across the “AWS EXPORT_NAME cannot be updated…” error when we try to update or delete the AWS CloudFormation stack.

Here, at Bobcares, we assist our customers with several AWS queries as part of our AWS Support Services.

Today, let us see how we can fix this error.

 

AWS EXPORT_NAME cannot be updated

Generally, we get this error when one or more stacks import and export output value from the stack that we want to update or delete.

We fail to perform the task if other stacks are importing values from the stack.

To avoid errors while we run the AWS Command Line Interface (AWS CLI) commands, we use the most recent version of the AWS CLI.

Moving ahead, our Support Techs recommend completing the following steps to resolve this error:

  • Find the stacks that import the export output value.

We can use three options to find the stacks that are referencing the exported output value.

They are, AWS CLI, AWS Tools for PowerShell, and the AWS CloudFormation console.

a) AWS CLI:

1. Initially, to list all exported output values, we run:

aws cloudformation list-exports

2. Then to list all stacks that import an export output value, we run:

aws cloudformation list-imports --export-name EXPORT_NAME

b) AWS Tools for PowerShell:

1. In this case, to list all exported output values, we run:

Get-CFNExport

2. Then to list all stacks that import an export output value, we run:

Get-CFNImportList -ExportName EXPORT_NAME

c) AWS CloudFormation console:

1. First, we open the AWS CloudFormation console.

2. From the CloudFormation menu, we select Exports.

3. After that, for Export Name, we select the name of the exported output value from the stack.

4. For Imports, we select the stacks that import the export output value from the stack.

  • Replace the Import statements with the actual output value

Now we need to update the stack template to replace the Import statements with the actual output value.

1. To do so, in the AWS CloudFormation template, we replace intrinsic functions with the imported values for every stack that references the exported output value of the stack.

For example, we replace both the intrinsic functions Fn::ImportValue and !ImportValue with the imported value arn:aws:s3:::sample.

Let us see how it is done in the following JSON and YAML templates.

a) 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"
}
}
}
}

b) YAML 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: !ImportValue sample-s3-bucket:Bucket-arn

YAML 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

2. Finally, we update or delete the stack.

Since the imports are disassociated, we can update or delete the stack that exported the values.

[Need further assistance? We are here for you]

 

Conclusion

In short, we saw how our Support Techs fix the AWS query for our customers.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.