
Answer-first summary for fast verification
Answer: Create an AWS Lambda function that will start and stop the EC2 instances and DB instances. Configure Amazon EventBridge to invoke the Lambda function on a schedule.
## Explanation **Correct Answer: D** **Why Option D is correct:** 1. **Cost Optimization**: AWS Lambda is serverless and only runs when invoked, so there's no cost for idle compute resources. This minimizes costs compared to running a dedicated EC2 instance (Option C) or using third-party solutions (Option B). 2. **Minimal Infrastructure Maintenance**: Lambda functions require no server management, patching, or maintenance. Amazon EventBridge (formerly CloudWatch Events) provides a fully managed event bus service. 3. **Automated Scheduling**: EventBridge can be configured with cron expressions to invoke the Lambda function on a schedule (e.g., start instances at 8 AM, stop instances at 6 PM). 4. **Native AWS Integration**: The Lambda function can use AWS SDKs to call EC2 and RDS APIs to start/stop instances, providing a fully managed AWS-native solution. **Why other options are incorrect:** **Option A**: - Elastic resize is for Redshift clusters, not EC2 instances - RDS instances cannot be scaled to zero; you can only stop them, which is different from scaling to zero - This approach doesn't provide automated scheduling **Option B**: - While AWS Marketplace solutions might work, they typically incur additional costs - Third-party solutions require additional management and may not be as tightly integrated - Doesn't minimize infrastructure maintenance as much as a serverless solution **Option C**: - Requires launching and maintaining another EC2 instance, which adds cost - Requires managing the instance (patching, security, monitoring) - The crontab solution adds operational overhead - Doesn't minimize infrastructure maintenance **Key AWS Services Used:** - **AWS Lambda**: Serverless compute service - **Amazon EventBridge**: Serverless event bus for scheduling - **Amazon EC2**: For compute instances - **Amazon RDS**: For database instances **Best Practice**: This solution follows AWS best practices for cost optimization by using serverless services to manage infrastructure lifecycle, eliminating the need for dedicated management servers.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
A company is migrating its on-premises workload to the AWS Cloud. The company already uses several Amazon EC2 instances and Amazon RDS DB instances. The company wants a solution that automatically starts and stops the EC2 instances and DB instances outside of business hours. The solution must minimize cost and infrastructure maintenance.
Which solution will meet these requirements?
A
Scale the EC2 instances by using elastic resize. Scale the DB instances to zero outside of business hours.
B
Explore AWS Marketplace for partner solutions that will automatically start and stop the EC2 instances and DB instances on a schedule.
C
Launch another EC2 instance. Configure a crontab schedule to run shell scripts that will start and stop the existing EC2 instances and DB instances on a schedule.
D
Create an AWS Lambda function that will start and stop the EC2 instances and DB instances. Configure Amazon EventBridge to invoke the Lambda function on a schedule.