Week
4
Scenario ID
L1-009
Problem Identification
Unused ECR Repositories:
- 5 ECR repositories (e.g.,
ecr-repository-qyefir) are configured with lifecycle policies to retain 10 images, but no evidence of active image usage was found in metric data.
- Monthly ECR cost is $20 (200GB × $0.10/GB), but storage utilization appears suboptimal.
Root Cause
- Unused Repositories: The 5 ECR repos are not actively used, as metric data shows stable image counts at the retention limit (10 images), indicating no new pushes or pulls.
- Over-Provisioned Storage: The 200GB storage allocation for ECR is unnecessary if only 10 images are retained, leading to wasted capacity.
Proposed Solution
-
Delete Unused Repositories:
- Remove 3 unused ECR repos (e.g.,
ecr-repository-x6h83c, oo2gsw, 4d3i9x)
- Retain 2 actively used repos (
qyefir, 2sg65l) with lifecycle policies
-
Optimize Storage:
- Reduce ECR storage from 200GB to 20GB (10 images × 2GB each)
- Update Terraform to reflect new resource counts
Estimated Monthly Savings (USD)
14
Optimized Terraform
# Optimized Terraform Configuration
# ECR Repositories (Retained: qyefir, 2sg65l)
resource "aws_ecr_repository" "ecr-repository-qyefir" {
name = "ecr-repository-qyefir"
storage_limit = 20 # GB
image_tag_mutability = "MUTABLE"
image_scanning_configuration {
scan_on_push = true
}
}
resource "aws_ecr_repository" "ecr-repository-2sg65l" {
name = "ecr-repository-2sg65l"
storage_limit = 20 # GB
image_tag_mutability = "MUTABLE"
image_scanning_configuration {
scan_on_push = true
}
}
# ECR Lifecycle Policies
resource "aws_ecr_lifecycle_policy" "ecr-lifecycle-qyefir" {
repository = aws_ecr_repository.ecr-repository-qyefir.name
policy = jsonencode({
rules = [{
rule_priority = 1
description = "Keep last 10 images"
selection = {
tag_status = "any"
count_type = "imageCountMoreThan"
count_number = 10
}
action = {
type = "expire"
}
}]
})
}
resource "aws_ecr_lifecycle_policy" "ecr-lifecycle-2sg65l" {
repository = aws_ecr_repository.ecr-repository-2sg65l.name
policy = jsonencode({
rules = [{
rule_priority = 1
description = "Keep last 10 images"
selection = {
tag_status = "any"
count_type = "imageCountMoreThan"
count_number = 10
}
action = {
type = "expire"
}
}]
})
}
Attached Reports
analysis_report.md
(Files committed to submissions/ directory)
Week
4
Scenario ID
L1-009
Problem Identification
Unused ECR Repositories:
ecr-repository-qyefir) are configured with lifecycle policies to retain 10 images, but no evidence of active image usage was found in metric data.Root Cause
Proposed Solution
Delete Unused Repositories:
ecr-repository-x6h83c,oo2gsw,4d3i9x)qyefir,2sg65l) with lifecycle policiesOptimize Storage:
Estimated Monthly Savings (USD)
14
Optimized Terraform
Attached Reports
analysis_report.md
(Files committed to submissions/ directory)