AWS DevOps Cost Optimization 5 — Questions and Answers
Question 1: A team uses AWS CloudTrail to audit all API calls made by their CI/CD pipeline. CloudTrail data event logging is generating significant S3 costs. What is the best cost reduction strategy?
- Disable CloudTrail data events entirely
- Filter CloudTrail data events to log only S3 and Lambda events for specific pipeline-related buckets and functions (Correct answer)
- Switch to CloudTrail Insights instead of data events
- Use a single trail for all regions instead of per-region trails
Correct answer: Filter CloudTrail data events to log only S3 and Lambda events for specific pipeline-related buckets and functions
CloudTrail data events are charged per 100,000 events; scoping data event logging to specific resources rather than all S3 buckets or Lambda functions dramatically reduces event volume and cost.
Question 2: Which AWS pricing model provides the greatest long-term savings for a stable CodeBuild project that runs builds continuously 8 hours per day, 5 days per week?
- On-Demand build minutes with no commitment
- CodeBuild Reserved Capacity for the estimated monthly build minutes (Correct answer)
- Spot-based CodeBuild instances
- CodeBuild with AWS Savings Plans applied
Correct answer: CodeBuild Reserved Capacity for the estimated monthly build minutes
CodeBuild Reserved Capacity lets teams purchase committed build minutes at a discount of up to 30% compared to On-Demand pricing, saving money on predictable, recurring build workloads.
Question 3: A team wants to minimize costs for running ephemeral Kubernetes clusters used in integration testing via their pipeline. Which approach is most cost-effective?
- Use a permanently running EKS cluster with all test nodes always active
- Spin up EKS clusters with Fargate Spot nodes on-demand for each test run and tear them down after completion (Correct answer)
- Use EC2 Reserved Instances as EKS worker nodes
- Run Kubernetes on a single large EC2 instance using k3s
Correct answer: Spin up EKS clusters with Fargate Spot nodes on-demand for each test run and tear them down after completion
Ephemeral EKS clusters with Fargate Spot nodes that are created and destroyed per test run eliminate idle costs and benefit from Spot pricing discounts for interruptible workloads.
Question 4: A pipeline generates thousands of SNS notifications daily for deployment events. Many subscribers rarely act on these notifications. Which architecture change reduces costs?
- Increase SNS message size to batch multiple events
- Replace SNS with SQS FIFO queues for all notifications
- Use SNS message filtering so each subscriber only receives relevant event types (Correct answer)
- Switch to email-only SNS subscriptions to reduce API costs
Correct answer: Use SNS message filtering so each subscriber only receives relevant event types
SNS message filtering applies subscription filter policies so subscribers only receive messages matching their criteria, reducing the number of messages delivered and the downstream processing costs.
Question 5: Which AWS Budgets configuration provides the best cost control for a CI/CD pipeline with variable but bounded spend?
- Set a monthly cost budget with email alerts at 50%, 80%, and 100% of the threshold
- Create a Cost Budget with automated actions that restrict IAM permissions or stop EC2 instances when spend exceeds the threshold (Correct answer)
- Use a usage budget tracking only CodeBuild minutes
- Configure a Savings Plans coverage budget only
Correct answer: Create a Cost Budget with automated actions that restrict IAM permissions or stop EC2 instances when spend exceeds the threshold
AWS Budgets automated actions can automatically apply restrictive IAM policies or stop EC2 instances when budget thresholds are breached, enforcing hard spending limits without manual intervention.
Question 6: A team's deployment pipeline includes an AWS Glue ETL job for data validation that runs for 10 minutes per deployment. Which Glue configuration minimizes cost for this short, infrequent job?
- Use Glue Standard workers with maximum DPUs allocated
- Use Glue Flex execution class with the minimum required DPUs (Correct answer)
- Switch to Glue Studio visual ETL for all jobs
- Use Glue DataBrew instead of Glue ETL for validation
Correct answer: Use Glue Flex execution class with the minimum required DPUs
Glue Flex execution uses spare compute capacity at a 34% discount compared to Standard and is suitable for non-urgent, time-flexible workloads like post-deployment validation jobs.
Question 7: A company wants to enforce cost optimization practices across all CI/CD pipeline deployments. Which tool automatically detects and flags over-provisioned resources before they are deployed?
- AWS Security Hub with CIS benchmarks
- AWS Cost Anomaly Detection
- Infracost integrated into the CodePipeline as a pre-deployment cost estimation step (Correct answer)
- AWS Trusted Advisor checks run post-deployment
Correct answer: Infracost integrated into the CodePipeline as a pre-deployment cost estimation step
Infracost integrates into CI/CD pipelines to generate cost estimates from infrastructure-as-code changes before deployment, allowing teams to catch over-provisioning in pull requests.
A team uses AWS CloudTrail to audit all API calls made by their CI/CD pipeline.
CloudTrail data event logging is generating significant S3 costs.
What is the best cost reduction strategy?