Cost-Optimized Architecture I
Explore how to design cost-optimized AWS architectures by managing EC2 instance lifecycles, comparing storage costs across S3, EBS, and EFS, understanding valid lifecycle transitions, and selecting the most cost-effective compute resources for workflows. This lesson enhances your ability to deliver efficient, secure, and resilient cloud solutions.
We'll cover the following...
Question 37
You are providing consulting services for a state organization focused on managing the state lottery. You have been tasked with generating 2 million barcodes as quickly as possible. This will require EC2 instances with an average CPU utilization of 70% for each one. To accomplish this, you plan to launch 10 EC2 instances to create the barcodes. You estimate that the instances will complete the job between 11 p.m. and 1 a.m. However, you want to avoid leaving the instances idle for up to 9 hours until the next morning.
How can you automatically terminate the instances once the task is completed with the least overhead and in a cost-effective manner?
A. Write a Python program that queries the instance status. Additionally, create a Lambda function that can be triggered when a specific status is reached to terminate the instance.
B. Develop a cron job that checks the instance status. If a certain status is met, have the cron job initiate CloudFormation to terminate the current instance and create a new one from a template. ...