Your team needs to create CloudFormation stacks for multiple web applications.
There are some common AWS resources that are used by most applications such as security groups.
These resources are not frequently modified after being created.
You want to manage these common AWS resources separately and other application stacks can easily reuse them when needed.
How would you achieve this requirement?
Click on the arrows to vote for the correct answer
A. B. C. D.Correct Answer - A.
Option A is CORRECT because after a stack exports its output values, other stacks can import them through the Fn::ImportValue function.
This method is useful when certain AWS resources in a stack are frequently used by other stacks.
Option B is incorrect because Fn::GetAttr is not the correct function to import the exported values from other stacks.
Fn::ImportValue should be used.
Option C is incorrect because nested stacks are suitable when you want to use a single stack to manage all the resources.
In this question, the information is shared between different stacks so the stack should export its values for others to use.
Option D is incorrect because “Import resources into stack” is used for moving resources between CloudFormation stacks.
It is not suitable to be used here.
Reference:
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-exports.html, https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-imports.htmlThe best approach to managing common AWS resources that are frequently reused by multiple CloudFormation stacks is to use a CloudFormation stack to create and manage these resources. This approach simplifies the management of AWS resources by centralizing their configuration, management, and updates in one place.
Option A is the correct answer because it allows us to create a CloudFormation stack that defines the common AWS resources and exports their output values. Other CloudFormation stacks can then import these resources using the Fn::ImportValue function, which retrieves the exported values. This approach simplifies the reuse of resources and makes it easy to update them in one place.
Option B is incorrect because the Fn::GetAttr function is used to retrieve the attributes of a resource that's already been created, while the question requires creating the common resources for reuse.
Option C is incorrect because while it allows nesting one CloudFormation stack within another, it does not provide a mechanism for reusing common resources across multiple CloudFormation stacks.
Option D is also incorrect because it requires manually importing resources into a CloudFormation stack using the AWS Console, which can be a time-consuming process and prone to errors.
To summarize, Option A is the best approach because it allows us to create a CloudFormation stack to define and manage the common AWS resources and export their output values for reuse by other CloudFormation stacks. This approach simplifies the management of AWS resources and makes it easy to update them in one place.