AWS DevOps Cost Optimization 4 — Questions and Answers
Question 1: A team uses AWS Step Functions to orchestrate their deployment workflow with many short-lived state transitions. Which Step Functions pricing model minimizes cost for high-frequency, fast-executing workflows?
- Standard Workflows with Express Workflow pricing
- Express Workflows, which bill per execution duration rather than per state transition (Correct answer)
- Standard Workflows with inline Map states
- Synchronous Express Workflows with maximum timeout
Correct answer: Express Workflows, which bill per execution duration rather than per state transition
Express Workflows bill based on the number of executions and their duration, making them far cheaper than Standard Workflows for high-volume, short-duration orchestration tasks.
Question 2: Which approach best reduces API Gateway costs for a webhook endpoint that triggers CodePipeline executions?
- Switch from REST API to HTTP API in API Gateway (Correct answer)
- Enable API Gateway caching for webhook responses
- Use a Regional endpoint instead of Edge-optimized
- Deploy the API to all available regions
Correct answer: Switch from REST API to HTTP API in API Gateway
HTTP APIs in API Gateway cost approximately 71% less than REST APIs and support the same webhook use cases, making them the most cost-effective choice for simple trigger endpoints.
Question 3: A DevOps team wants to reduce costs on their multi-region deployment pipeline that replicates artifacts across 5 regions. Which strategy is most cost-effective?
- Store all artifacts in S3 and replicate using S3 Cross-Region Replication
- Deploy artifacts on-demand to each region only when a deployment is triggered in that region (Correct answer)
- Use CloudFront to serve artifacts to all regions from a single origin
- Create separate CodePipeline instances in each region
Correct answer: Deploy artifacts on-demand to each region only when a deployment is triggered in that region
Deploying artifacts to regions only when deployments are triggered avoids paying for pre-replication data transfer and storage in regions that may not be actively used.
Question 4: A team's CodeBuild project pulls a large base Docker image (8GB) on every build. What is the most cost-effective solution to reduce build time and data transfer costs?
- Use a smaller CodeBuild compute type to reduce the image pull overhead
- Build a custom base image with pre-installed dependencies and store it in ECR, then use CodeBuild Docker layer caching (Correct answer)
- Pull the image from Docker Hub instead of ECR to avoid transfer fees
- Increase the CodeBuild environment disk size
Correct answer: Build a custom base image with pre-installed dependencies and store it in ECR, then use CodeBuild Docker layer caching
A pre-built base image stored in ECR combined with Docker layer caching means CodeBuild only pulls changed layers, drastically reducing build duration and intra-region transfer costs.
Question 5: Which AWS Compute Optimizer recommendation is most actionable for reducing EC2 costs in a deployment fleet managed by CodeDeploy?
- Switch all instances to previous-generation instance families
- Downsize over-provisioned instances to a smaller instance type that still meets performance requirements (Correct answer)
- Convert all instances to Spot Instances immediately
- Disable detailed monitoring on all instances
Correct answer: Downsize over-provisioned instances to a smaller instance type that still meets performance requirements
Compute Optimizer analyzes CloudWatch metrics to identify over-provisioned instances and recommends right-sized instance types that reduce costs while maintaining performance.
Question 6: A team runs hourly health-check Lambda functions as part of their post-deployment verification. Lambda logs generate significant CloudWatch Logs costs. What is the best mitigation?
- Disable CloudWatch Logs for all Lambda functions
- Set CloudWatch Logs retention policies on Lambda log groups to 7 days instead of Never Expire (Correct answer)
- Switch Lambda logging to X-Ray traces only
- Increase Lambda memory to reduce the number of log entries
Correct answer: Set CloudWatch Logs retention policies on Lambda log groups to 7 days instead of Never Expire
CloudWatch Logs storage is billed monthly per GB stored; setting a short retention period on frequently-writing Lambda log groups significantly reduces the total stored log volume.
Question 7: A company uses AWS CodeArtifact to host internal npm packages for their CI/CD pipeline. Which practice reduces CodeArtifact costs?
- Store all upstream package versions in CodeArtifact permanently
- Configure upstream repository connections and rely on CodeArtifact's pull-through cache rather than copying all packages proactively (Correct answer)
- Mirror all public npm packages into CodeArtifact
- Create separate CodeArtifact domains for each team
Correct answer: Configure upstream repository connections and rely on CodeArtifact's pull-through cache rather than copying all packages proactively
Using upstream connections lets CodeArtifact cache packages on first request rather than pre-populating the repository, reducing storage costs by only caching packages that are actually used.
A team uses AWS Step Functions to orchestrate their deployment workflow with many short-lived state transitions.
Which Step Functions pricing model minimizes cost for high-frequency, fast-executing workflows?