When is resource replacement ever desired? #20275
-
It seems to be generally recommended to avoid giving CDK resources custom names. This is because if an update to the resource requires replacement, CloudFormation will be unable to perform that update. This is an innate limitation within CloudFormation. However, I am wondering when this replacement would ever actually be beneficial. If an RDS instance, Elasticache instance, or even ECS service ever attempts to be replaced, it seems like we would instead want to carefully stage a migration plan- e.g. provision a new instance, migrate traffic over, then delete the old one from our template. Are different resources intended to be able to handle this process transparently for us- for example will replacing an ECS load balanced service intelligently migrate traffic? If not, why should we not utilize custom names to make infrastructure names more human friendly and to guard against accidental replacement? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Answer: We recommend against specifying the names of resources because it causes a conflict that is hard/annoying to get out of if you end up making another change that requires replacing your resource. |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Answer: We recommend against specifying the names of resources because it causes a conflict that is hard/annoying to get out of if you end up making another change that requires replacing your resource.
You should only go through resource replacement if you need to change something about your resource that requires resource replacement to do so. There may be unwanted side effects to doing this depending on what kind of resource you are dealing with