SOA-C02 Deployment, Provisioning, and Automation Practice Question
A DevOps engineer wants to automate the creation of an Amazon EC2 instance with a specific security group and IAM role. Which AWS service should be used to define the infrastructure as code?
⚠ Common exam trap
SOA-C02 often tests the distinction between IaC services and deployment/configuration services, so candidates must recognize that CloudFormation is the declarative IaC tool, while CodeDeploy, Elastic Beanstalk, and OpsWorks serve different purposes.
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 the infrastructure-as-code (IaC) service that allows you to define AWS resources such as EC2 instances, security groups, and IAM roles in declarative JSON or YAML templates. It automates provisioning and management of the entire stack, ensuring consistent and repeatable deployments. This directly matches the requirement to define infrastructure as code.
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
Elastic Beanstalk is a platform-as-a-service that automatically handles capacity provisioning, load balancing, and health monitoring, but it deliberately abstracts the underlying resources from the user. Although you can inject configuration via .ebextensions or option_settings, you cannot express the full range of AWS infrastructure components declaratively. For a DevOps engineer needing precise, repeatable control over resources like IAM roles, VPC endpoints, and custom security group rules, CloudFormation's template-based provisioning is the correct IaC service.
- ✗
AWS CodeDeploy
Why it's wrong here
CodeDeploy automates the deployment of application code to existing compute resources such as EC2 instances or Lambda functions. It does not create or modify infrastructure like subnets, NAT gateways, or autoscaling groups; it assumes the infrastructure is already present. While it can integrate with CloudFormation for a full pipeline, CodeDeploy alone cannot satisfy an automation requirement for infrastructure creation.
- ✓
AWS CloudFormation
Why this is correct
CloudFormation is the native AWS infrastructure-as-code service: you define resources in a JSON or YAML template, and the service provisions, updates, and deletes them as a stack with order-aware dependencies and automatic rollback on failures. It supports almost every AWS resource and allows drift detection to compare actual configuration to template state. This exactly matches the goal of automating creation of Amazon infrastructure.
- ✗
AWS OpsWorks
Why it's wrong here
OpsWorks is a configuration management service using Chef or Puppet; it focuses on how software is installed and configured on servers, not on defining cloud infrastructure itself. It can manage EC2 instances and deploy application code, but it does not provide a declarative language for creating a custom VPC, DynamoDB tables, or other services. For infrastructure provisioning at the AWS-resource layer, CloudFormation offers the desired template-driven control.
Go deeper
Related to this question
About these practice questions
This SOA-C02 question is part of Courseiva's 1,169-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 →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Amazon Web Services exam blueprint
This SOA-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 SOA-C02 exam.