Referring to existing stacks
In large environments with shared responsibility models, where different teams manage their own stack resources, we sometimes have a situation that resources or resource attributes (RDS instance endpoints, for example) have to be shared between different stacks.
Remember that we have a network stack in our application. Resources from this stack, such as subnets, are used in the application templates.
Whenever you deploy a virtual machine, AutoScaling group, load balancer, or a database cluster, you need to specify the subnet ID. We can specify that subnet ID as a parameter and then use Fn::Ref
to map it in the resource attribute, but that will require a lot of unnecessary actions that can be avoided, by using exports and Fn::ImportValue
.
In Chapter 1, CloudFormation Refresher, we used outputs to obtain the ARN of the IAM role, which we used in the AWS command line.
Outputs are handy for quickly accessing the attributes of created resources,...