How to Automatically Modify EC2 Spot Requests When Capacity Is Unavailable?
Short answer
A Use CloudWatch Events to match the instance-stopped-no-capacity Spot status and invoke Lambda to modify the Spot request with a new instance family.
Question
The company needs a solution that can automatically modify a spot request and add a new instance family when current instance types are unavailable.
Which solution will meet this requirement?
Key Takeaways
The exam tests event-driven remediation for Spot capacity shortfalls; the trap is assuming CloudTrail records Spot request status changes when it only logs API activity.
This scenario tests how to detect EC2 Spot request capacity failures and automatically modify the request to add another instance family. The correct approach uses CloudWatch Events to match the instance-stopped-no-capacity status and invoke Lambda, not CloudTrail API logging.
Common mistake: Most candidates pick CloudTrail plus EventBridge because it sounds like the standard event-driven pattern, but CloudTrail does not emit Spot request state changes such as capacity-not-available.
Expert Analysis
Why the Answer Is Correct
Option A is correct because EC2 Spot request problems are surfaced through CloudWatch Events/EventBridge status events, including the instance-stopped-no-capacity status that indicates the current instance type cannot be fulfilled. A CloudWatch Events rule can match that event and trigger an AWS Lambda function to modify the Spot request or Spot Fleet request configuration. The Lambda function can then add a new instance family and preserve capacity for the game servers. This gives the gaming company automated remediation instead of manual monitoring of Spot availability.
Why the Other Options Are Wrong
Option B is wrong because AWS CloudTrail records API calls such as RequestSpotInstances and CancelSpotInstanceRequests, not internal Spot request status transitions like instance-stopped-no-capacity. Creating an EventBridge rule on CloudTrail logs therefore does not reliably detect the capacity failure described in the question. Option C is too vague because CloudWatch logs and metrics alone do not invoke Lambda without a defined event rule or subscription filter, and it does not identify the Spot capacity event. Option D is also wrong because Systems Manager Automation can run a runbook, but it does not natively detect Spot request failures; you still need an event source such as CloudWatch Events, and the runbook alone does not add a new instance family.
Community Comment Notes
Bad_Mat selected option B and described using "CloudTrail to log EC2 spot request state changes" with an EventBridge rule invoking Lambda. That reflects the common misconception that CloudTrail is the event source for resource state changes, when CloudTrail is primarily an API activity log. The single learner comment is useful context, but it is not evidence that CloudTrail captures Spot capacity status changes.
Official Reference
- https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-request-status.html
- https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/WhatIsCloudWatchEvents.html
These links open the official vendor documentation in a new tab.
Exam Strategy
When an option claims CloudTrail captures a resource's internal state, challenge it: CloudTrail captures API calls, not Spot request status transitions. For Spot capacity automation, look for CloudWatch Events/EventBridge matching a Spot status code and a Lambda remediation action.
Frequently Asked Questions
Why is CloudTrail not the right event source for Spot request state changes?
Can Lambda add a new instance family to an existing Spot request?
Discussion 1 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 1
-
Bad_Mat 👍 1 Answered BAWS CloudTrail to log EC2 spot request state changes. Configure an Amazon EventBridge rule on the CloudTrail log to invoke an AWS Lambda function to modify the spot request.
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All SOA-C03 Questions
Access 100 questions with complete answers and detailed explanations.
View Full SOA-C03 Practice Test →