Designing the solution
We now have all the information we need to start designing our application. We need to coordinate four different API calls per CloudFormation stack:
describeStacks
: To list all available stacksdescribeStackResources
: To retrieve details of all resources contained in a stackdescribeInstances
: To retrieve details of all EC2 instances in a stackdescribeDBInstances
: To retrieve details of all DB2 instances in a stack
Next, I would like you to step back for a moment and think about how you would design code like this. Go ahead, I'll wait.
Now that you're back, let's have a look at one possible approach.
If we recall the screenshot of what the dashboard would look like, we realize that, for the purposes of our application, the difference between EC2 and RDS resources can be completely ignored so long as each one has the attributes ID, type, and status.
This means whatever our solution may be, it has to somehow provide a uniform way of abstracting the different resource types...