Interview Prep/AWS/S3, EBS and EFS

The bill shows far more S3 storage than `aws s3 ls --summarize` reports.

AdvancedTroubleshootingS3, EBS and EFS
Answer

Likely causes → Incomplete multipart uploads (the parts are stored and billed, but ls does not show them), noncurrent versions, or storage-class overhead (minimum object size and duration charges for IA and Glacier).

Diagnose →

aws s3api list-multipart-uploads --bucket data --query 'Uploads[].[Key,Initiated]' --output table
aws cloudwatch get-metric-statistics --namespace AWS/S3 --metric-name BucketSizeBytes \
  --dimensions Name=BucketName,Value=data Name=StorageType,Value=StandardStorage \
  --statistics Average --period 86400 --start-time $(date -u -d '-3 day' +%FT%TZ) --end-time $(date -u +%FT%TZ)

Fix →

  1. Abort stale uploads: aws s3api abort-multipart-upload --bucket data --key <key> --upload-id <id>
  2. Add a lifecycle rule with AbortIncompleteMultipartUpload DaysAfterInitiation: 7

Prevent → Put that lifecycle rule on every bucket by default, and use Storage Lens for "incomplete MPU bytes".

aws All AWS questions Roadmap: AWS core services

More on S3, EBS and EFS