Updating an AWS CloudFormation stack fails with an error message similar to the following: 'CloudFormation cannot update a stack when a custom-named resource requires replacing. Rename 'MYResourceXXX' and update the stack again."

Some resources support using properties with custom names. CloudFormation will not replace a resource with custom named properties unless the custom names are different from the existing names.

In the following example, the DBInstanceIdentifier property of an Amazon RDS resource is set to the custom name PRODdb. A CloudFormation stack update will only replace the Engine for the MyRDS resource if the value of the DBInstanceIdentifier property is changed to something other than PRODdb.

"MyRDS": {
     "Type": "AWS::RDS::DBInstance",
     "Properties": {
          "DBInstanceClass": "db.m3.medium",
          "Engine": "MySQL",
          "DBInstanceIdentifier": "PRODdb"
          "AllocatedStorage": "10",
          "AutoMinorVersionUpgrade": "true",
          "BackupRetentionPeriod": "0",
          …
          …
}

Before updating a stack to replace resources, ensure that you change any custom names properties associated with the resource. For example, to update the MyRDS resource and replace the MySQL engine with a different engine, you would change the custom name PRODdb for the DBInstanceIdentifier property to something different, such as PRODdb2.

AWS CloudFormation, stack, update, custom, name, replace resource, error


Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center.