0
0
AWScloud~20 mins

Outputs for cross-stack references in AWS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Cross-Stack Reference Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
service_behavior
intermediate
2:00remaining
What is the output of this CloudFormation stack's output section?
Given this CloudFormation output configuration, what will be the value of the output named BucketNameOutput after deployment?

Outputs:
  BucketNameOutput:
    Description: "Name of the S3 bucket"
    Value: !Ref MyS3Bucket
    Export:
      Name: "MyApp-BucketName"
AThe physical name of the S3 bucket resource created in this stack.
BThe ARN of the S3 bucket resource.
CThe region where the stack is deployed.
DThe CloudFormation stack ID.
Attempts:
2 left
💡 Hint
The !Ref function returns the logical resource's name or ID depending on the resource type.
Architecture
intermediate
2:00remaining
Which option correctly describes how to import a value exported by another stack?
You have a CloudFormation stack exporting a value named MyApp-BucketName. How can another stack import this value to use it in a resource property?
AUse the intrinsic function !GetAtt with the export name, like !GetAtt MyApp-BucketName.
BUse the intrinsic function !Ref with the export name, like !Ref MyApp-BucketName.
CDirectly reference the exporting stack's resource logical ID.
DUse the intrinsic function !ImportValue with the export name, like !ImportValue MyApp-BucketName.
Attempts:
2 left
💡 Hint
Look for the function designed to import exported values across stacks.
security
advanced
2:00remaining
What is a security risk when exporting sensitive information in stack outputs?
If a CloudFormation stack exports a secret key or password in its Outputs section, what is the main security risk?
AAnyone with access to the AWS account can view the exported secret in the CloudFormation console or API.
BThe secret is automatically encrypted and safe to export.
CThe secret is only visible to the stack creator and cannot be accessed by others.
DExported outputs are not stored and thus pose no risk.
Attempts:
2 left
💡 Hint
Consider who can view stack outputs and exports in AWS.
Configuration
advanced
2:00remaining
What error occurs if two stacks export outputs with the same name?
Two CloudFormation stacks export outputs with the same export name MyApp-BucketName. What happens when you try to deploy the second stack?
AThe second stack overwrites the first stack's export silently.
BDeployment fails with a validation error about duplicate export names.
CBoth stacks deploy successfully without any conflict.
DThe second stack's export is ignored and not created.
Attempts:
2 left
💡 Hint
Export names must be unique across all stacks in an AWS account and region.
Best Practice
expert
3:00remaining
Which approach best ensures stable cross-stack references when stack resources are renamed or replaced?
You want to export a resource identifier for cross-stack use, but the resource's logical ID or physical name might change during updates. What is the best practice to maintain stable references?
AAvoid exporting and instead hardcode values in dependent stacks.
BExport the resource's logical ID directly, assuming it never changes.
CExport a fixed, manually specified parameter or resource attribute that does not change on updates.
DExport the resource's physical ID generated by CloudFormation, even if it changes on replacement.
Attempts:
2 left
💡 Hint
Think about what stays constant even if the resource is replaced.