Courseiva
SDLC Automation →easyMultiple Choice

DOP-C02 SDLC Automation Practice Question

A DevOps engineer needs to automate the creation of an Amazon ECS cluster using AWS CloudFormation. The cluster will run a web application that requires a load balancer. Which resource should be used to define the ECS cluster?

⚠ Common exam trap

It's easy for candidates to confuse the resource that defines the cluster (AWS::ECS::Cluster) with the resource that runs tasks and attaches a load balancer (AWS::ECS::Service), leading them to select the service option when the question only asks for the cluster definition.

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

✓

AWS::ECS::Cluster

The AWS::ECS::Cluster resource is the correct CloudFormation resource to define an ECS cluster, which serves as the logical grouping of container instances or Fargate tasks. The question specifically asks for the resource that defines the cluster itself, not the services or tasks running within it. A load balancer can be associated with the cluster via an AWS::ECS::Service resource, but the cluster definition is solely handled by AWS::ECS::Cluster.

Answer analysis

Option-by-option breakdown

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

  • ✗

    AWS::ECS::Service

    Why it's wrong here

    This resource is used to run and maintain a specified number of instances of a task definition in an ECS cluster. It handles scheduling, load balancing, service discovery, and desired count scaling, but it does not create the underlying compute capacity or the logical container group. In CloudFormation, a service requires an existing cluster to launch tasks into, so it is not the resource for automating cluster creation.

  • ✗

    AWS::ECS::TaskDefinition

    Why it's wrong here

    A task definition is a blueprint that describes the container(s), images, CPU/memory requirements, networking mode, and volumes for an ECS task. It does not provision any infrastructure; it is just a template that the ECS scheduler uses to place tasks. Creating a task definition does not create a cluster, so this resource is not correct for automating cluster creation.

  • ✗

    AWS::ECS::ContainerInstance

    Why it's wrong here

    There is no such CloudFormation resource type. A container instance is an EC2 instance that runs the ECS agent and registers with an ECS cluster, but it is not a standalone CloudFormation resource. To model it in infrastructure as code, you would typically use AWS::EC2::Instance with user data to install the ECS agent, or use AWS::AutoScaling::AutoScalingGroup with a launch template; it is not a native ECS resource in CloudFormation.

  • ✓

    AWS::ECS::Cluster

    Why this is correct

    The AWS::ECS::Cluster resource provisions a logical ECS cluster, which is the fundamental grouping of container instances or Fargate capacity where tasks and services are launched. In CloudFormation, this is the correct resource to automate the creation of the ECS cluster itself, and you can additionally configure settings like cluster name, capacity providers, and default namespaces via this resource. It is the top-level construct that other ECS resources like services and task definitions reference.

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.