This article does not explain the usual action following retaining, which is the intent to re-use the retained resource in the next stack creation. Regardless of using a custom or auto-generated name, how does one import them? The ".from" static functions on the CDK resources for imports are only pointers to the account resources and cannot be resumed with ongoing modifications to the stack resources.
Thank you for your comment. We'll review and update the Knowledge Center article as needed.
Unfortunately, this post is very disappointing. Is there a way AWS CDK can be smart to automatically import these retained stateful resources back into the stack? That was the resolution I was hoping to see. Correct me if I'm wrong, but if we'd like to keep the date stored in these resources, we'd have to craft a workaround? Perhaps, rename retained resource and write some script / lambda function to import items?
Thank you for your comment. We'll review and update the Knowledge Center article as needed.
What if I want to reuse the resource? That's the main purpose of retaining it in my case also.
Thank you for your comment. We'll review and update the Knowledge Center article as needed.
CDK should automatically import resources that already exist, otherwise it's largely useless for IaC for anything that isn't stateless.
Echoing the replies you have already received on this article. The usual desired behavior is to re-import these already existing resources. You should either explain how to do that manually or implement the behavior for cdk to do this.
Relevant content
- asked 7 months ago
- Accepted Answerasked 4 months ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 4 months ago