Courseiva
SDLC Automation →easyMultiple Choice

DOP-C02 SDLC Automation Practice Question

A DevOps engineer wants to automate the creation and cleanup of temporary development environments on AWS. Each environment consists of an Amazon EC2 instance and an Amazon RDS database. The environments should be isolated and cost-effective. Which AWS service is best suited for this?

⚠ Common exam trap

Test-takers frequently confuse AWS Elastic Beanstalk's environment management (which does create EC2 and RDS) with the ability to easily and cost-effectively tear down temporary environments, but Elastic Beanstalk environments are designed for persistent applications and lack the simple, automated stack deletion that CloudFormation provides for ephemeral workloads.

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 CloudFormation

AWS CloudFormation is best suited because it allows you to define the entire temporary environment—EC2 instance and RDS database—as infrastructure as code (IaC) in a single template. You can create and delete the entire stack with one API call, ensuring isolation via separate stacks and cost-effectiveness by automating cleanup when the stack is deleted.

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 Elastic Beanstalk

    Why it's wrong here

    AWS Elastic Beanstalk is a Platform-as-a-Service that abstracts the underlying EC2 instances and RDS databases into an application environment, handling scaling, load balancing, and health checks automatically. While it can provision these resources, it is less flexible for custom, repeatable temporary environments because the environment lifecycle is tied to the application model, and by default RDS instances are not deleted when the Elastic Beanstalk environment is terminated, complicating automated cleanup. Its configuration is largely convention-based and less deterministic than a pure Infrastructure-as-Code template.

  • ✓

    AWS CloudFormation

    Why this is correct

    AWS CloudFormation is the definitive Infrastructure-as-Code service that uses declarative JSON/YAML templates to provision and manage all resources in a stack, including EC2 instances, RDS databases, VPCs, and security groups as a single unit. Stack creation handles dependency ordering and rollback on failure, while stack deletion removes the complete set of resources, enabling reliable automation of ephemeral environments. The ability to set a deletion policy on resources like RDS allows you to control whether the database is retained or deleted, making cleanup predictable and safe.

  • ✗

    AWS OpsWorks

    Why it's wrong here

    AWS OpsWorks is a configuration management service built on Chef and Puppet, focused on automating server configuration, application deployment, and lifecycle events across existing or newly created EC2 instances using layers and recipes. It is not designed to create and tear down a complete, isolated temporary environment that includes RDS; managing the RDS database and its lifecycle is outside OpsWorks' core scope. Its model is imperative and instance-centric, lacking CloudFormation's declarative stack-level dependency graph and all-or-nothing deletion semantics, which makes it unwieldy for repeatable environment cleanup.

  • ✗

    Amazon ECS

    Why it's wrong here

    Amazon ECS is a container orchestration service for running Docker containers across a cluster of EC2 instances or AWS Fargate-managed infrastructure, abstracting away the underlying hosts. It does not provide native resources for traditional EC2 instances (as virtual machines hosted directly) or RDS relational databases; you would need separate CloudFormation or manual provisioning for those components. ECS focuses purely on the deployment and scaling of containerized microservices, so it is unsuitable for automating the creation and cleanup of a conventional EC2+RDS environment.

About these practice questions

This DOP-C02 question is part of Courseiva's 1,298-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. 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.