DOP-C02 Resilient Cloud Solutions Practice Question
A company runs an application on EC2 with a shared Elastic IP. The instance fails and an engineer manually attaches the Elastic IP to a standby instance. To automate this failover, which service should be used?
⚠ Common exam trap
It's easy for candidates to confuse event-driven automation (CloudWatch Events + Lambda) with scaling or deployment services (Auto Scaling, Elastic Beanstalk), or they assume adding a second Elastic IP solves failover without considering the need for automated reassignment.
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
✓
CloudWatch Events with a Lambda target
C is correct because CloudWatch Events (now Amazon EventBridge) can detect the EC2 instance state change (e.g., 'stopped' or 'failed') and trigger a Lambda function. The Lambda function can then programmatically disassociate the Elastic IP from the failed instance and reassociate it to a standby instance using the AWS SDK (e.g., ec2.disassociate_address and ec2.associate_address). This provides a fully automated, event-driven failover without manual intervention.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use an Auto Scaling group with a lifecycle hook
Why it's wrong here
An Auto Scaling group lifecycle hook pauses instances during launch or termination so you can run custom actions, but it has no intrinsic ability to reassign a shared Elastic IP. Even if the ASG replaces an unhealthy instance, the EIP remains associated with the old resource unless a separate, custom script explicitly detaches and reattaches it. Lifecycle hooks only signal state transitions; they do not implement the network address re-mapping logic required for failover.
- ✗
AWS Elastic Beanstalk
Why it's wrong here
AWS Elastic Beanstalk is a PaaS service that abstracts provisioning and deployment but does not provide an Elastic IP failover mechanism. Beanstalk environments typically use a load balancer or a public endpoint, and they do not expose built-in controls to move a static Elastic IP between compute resources. Relying on Beanstalk alone would leave the EIP pinned to a single instance, with no automated response to health check failures or instance loss.
- ✓
CloudWatch Events with a Lambda target
Why this is correct
CloudWatch Events (now EventBridge) can capture Simple Notification Service messages or CloudWatch alarm state changes triggered by a Route 53 health check or EC2 status check, and then invoke an AWS Lambda function. That function can programmatically call ec2-associate-address to detach the Elastic IP from the failed instance and attach it to a healthy one, fully automating active/passive failover. This approach is the standard serverless pattern for EIP failover because it reacts to health signals and directly manages the association.
- ✗
Configure a second Elastic IP
Why it's wrong here
Configuring a second Elastic IP does nothing to automate failover; it merely gives you another static address to manage manually. Without a monitoring or control plane to detect an instance failure and switch the address, the application remains unreachable until an operator intervenes. This option also introduces unnecessary complexity by requiring manual DNS changes or disassociate/associate calls, which defeats the purpose of high availability.
Quick reference
Cloud Service Model Comparison
| Model | You Manage | Provider Manages | Examples |
|---|---|---|---|
| IaaS | OS, runtime, apps, data | Hardware, hypervisor, networking | EC2, Azure VMs, GCP Compute Engine |
| PaaS | Apps and data | OS, runtime, middleware, hardware | Elastic Beanstalk, Azure App Service |
| SaaS | Data and settings only | Everything else | Microsoft 365, Salesforce, Workday |
| FaaS / Serverless | Function code only | Infra, scaling, runtime | Lambda, Azure Functions, Cloud Run |
| CaaS | Containers and apps | Kubernetes, OS, hardware | EKS, AKS, GKE |
Go deeper
Related to this question
About these practice questions
One of 1,013 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 →
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.