An IT firm is deploying all its production resources using AWS CloudFormation Templates.
A complex stack is to be deployed wherein one stack's output values will be used as an input to another stack in the same group.
As a SysOps administrator, you need to create a template for this stack with minimum efforts & the least resources.
This template will be used in all further deployments.
Also, there is a Security guideline to ensure no information is shared outside the stack.
Which of the following is the preferred option to meet this requirement?
Click on the arrows to vote for the correct answer
A. B. C. D.Correct Answer: C.
A nested Stack can be used to share information within a group of stacks.
A nested stack is preferred when information needs to be isolated within the stacks & not share outside to other stacks.
Option A is incorrect as this will incur additional work for the creation of Lambda function.
Option B is incorrect as this will incur additional admin work for inputting values in each template.
Option D is incorrect as export values can be used to share values with other stacks in the same AWS account or region.
In the above case, information needs to share within the same group.
So using a nested stack will be a better option.
For more information on exporting values between stacks, refer to the following URL-
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-exports.htmlThe preferred option to meet the requirement of sharing information between stacks in the same group without sharing information outside the stack is to use the export function between stacks to have the output of one stack serve as the input of another stack.
Option A, which suggests using a Lambda function to export stack values between stacks in the same group, is not the preferred option because it involves additional resources and complexity that are not necessary for this scenario.
Option B, which suggests hardcoding resource values in the stack template to share values between stacks in the same group, is not the preferred option because it is not scalable and requires manual changes to be made in each stack deployment.
Option C, which suggests using nested stacks to share information between stacks, is not the preferred option because it may introduce unnecessary complexity and may not be required for the specific scenario described in the question.
Using the export function between stacks to share information is a best practice for CloudFormation because it allows stacks to remain independent while sharing information between them. This approach ensures that information is not shared outside the stack and minimizes resource usage and complexity.
To implement this approach, the output of the first stack can be exported using the Export
attribute, and then the second stack can import that output using the Fn::ImportValue
function. This approach is scalable, easily repeatable, and provides a clean separation of resources between stacks.