I have a monolith cloudformation stack in every microservices creating the same kind of resource, I want to make it modular by breaking it into the nested stack and reusing them in each service. My understanding of nested stack is that you can use them as reusable units to create bundled resources. I am aware about the importing existing resource by setting the deletion policy to retain and importing in another stack. I am having trouble understanding how I can use the existing resources in the nested stack and also keeping it reusable. If I have import logic in the nested stack then it cannot be reused?
For example, let's say you create an EC2 instance along with cloudwatch alarms in each stack. I would like to modularize it by putting all the related resources into a nested stack called MyEC2Stack. I can then use MyEC2Stack in the parent stack to create as many resources as I want. Now my usecase is to use MyEc2Stack to create the resources that existed before as well as a new set of resources. How can I achieve that?