Courseiva
SDLC Automation →easyMultiple Choice

DOP-C02 SDLC Automation Practice Question

A company uses AWS CloudFormation to manage a stack that includes an Amazon SQS queue. The queue name must be unique. The developer wants to define the queue name in the CloudFormation template. Which intrinsic function should be used to generate a unique name?

⚠ Common exam trap

Many candidates confuse `Fn::GetAtt` (which retrieves attributes like ARN or URL) with the ability to generate a unique name, but `Fn::GetAtt` cannot create or modify a name string—it only reads existing resource properties.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Fn::Sub

A is correct because `Fn::Sub` can embed a pseudo parameter like `AWS::StackName` or `AWS::AccountId` into a string to generate a unique queue name. By using `Fn::Sub` with a reference to the stack name or a random string, you can create a name that avoids collisions across accounts or regions, satisfying the uniqueness requirement for SQS queue names.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    Fn::Sub

    Why this is correct

    Fn::Sub is the correct choice because it performs variable and pseudo-parameter substitution on a string literal, allowing you to embed ${AWS::StackName} and other pseudo parameters like ${AWS::AccountId} directly into a bucket name. This creates a predictable, globally unique S3 bucket name that is automatically tied to the stack, eliminating the need to hardcode a name and reducing the risk of collisions when the stack is deployed in multiple environments.

  • ✗

    Fn::Select

    Why it's wrong here

    Fn::Select returns a single element from a list based on a zero-based index, such as selecting the first availability zone from Fn::GetAZs. It does not generate new strings or inject stack-level pseudo parameters into a literal, so it cannot independently create a unique bucket name. While it might be used as part of a larger expression involving Fn::Sub or Fn::Join, by itself it cannot satisfy the requirement of producing a unique name derived from the stack.

  • ✗

    AWS::NoValue

    Why it's wrong here

    AWS::NoValue is a special pseudo parameter that tells CloudFormation to remove a property entirely from the resource definition, not to supply a value. It is commonly used in conditional logic to conditionally omit properties, but it cannot produce a string like a bucket name, let alone one that is unique. Therefore, it is completely unsuited for naming an S3 bucket; it only controls whether a property exists in the final template.

  • ✗

    Fn::GetAtt

    Why it's wrong here

    Fn::GetAtt retrieves a specific attribute from a resource that already exists in the stack, such as the ARN or endpoint of an S3 bucket. It is a read-only reference keyed by the resource's logical ID and cannot incorporate pseudo parameters like AWS::StackName into a string literal. Since the bucket name must be defined before the bucket exists, Fn::GetAtt cannot be used to generate that name; it can only fetch values of resources that have already been created, making it an invalid mechanism for unique naming.

About these practice questions

One of 1,298 original DOP-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This DOP-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DOP-C02 exam.