I'm unable to update an AWS CloudFormation stack and I see an error 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. This error typically occurs when a stack update attempts to replace resources with custom-named properties. When an update attempts to replace a resource with custom-named properties, the custom names must be changed before the resource can be replaced. CloudFormation will not replace a resource with custom-named properties unless the custom names are changed.

In the following example snippet, the DBInstanceIdentifier property of an Amazon RDS resource is set to the custom name PRODdb. A CloudFormation stack update can replace the Engine for the MyRDS resource as long as the name 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 that replaces resources, be sure that you change any custom names associated with resource properties. For example, to update the MyRDS resource and replace the MySQL engine with a different engine, change the custom name PRODdb for the DBInstanceIdentifier property to something else, such as PRODdb2.


Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center.

Published: 2015-08-28

Updated: 2018-05-03