← All posts
2 min read

Configure S3 Storage Class Analysis

#aws#cli#s3#storage#analytics#cost
📑 On this page

Part 70 of AWS from Zero. This lesson keeps the scope to one S3 behavior you can verify from the terminal.

What we are learning

Storage Class Analysis observes access patterns to help evaluate transitions from Standard to Standard-IA.

Before you run it

aws sts get-caller-identity
REGION="ap-south-1"
BUCKET="replace-with-your-private-demo-bucket"

Use a private general purpose bucket that you own. Replace every placeholder before running a write or delete command.

Cost note: Review current S3 pricing for analytics and exported analysis data before broad deployment.

The command

cat > analytics.json <<'EOF'
{
  "Id": "ReportsAnalysis",
  "Filter": {"Prefix": "reports/"},
  "StorageClassAnalysis": {}
}
EOF
 
aws s3api put-bucket-analytics-configuration \
  --bucket "$BUCKET" \
  --id ReportsAnalysis \
  --analytics-configuration file://analytics.json

A successful configuration command may return no output. Treat inspection as a separate required step.

Inspect the result

aws s3api get-bucket-analytics-configuration \
  --bucket "$BUCKET" \
  --id ReportsAnalysis

Read the returned fields rather than assuming the write succeeded exactly as intended.

One tiny variation

aws s3api list-bucket-analytics-configurations \
  --bucket "$BUCKET" \
  --query "AnalyticsConfigurationList[].{ID:Id,Filter:Filter}"

Audit all analysis scopes before creating overlapping configurations.

Common mistake

Analysis needs observation time and is not a promise that every object should transition. Retrieval patterns and object sizes still matter.

Cleanup

aws s3api delete-bucket-analytics-configuration \
  --bucket "$BUCKET" \
  --id ReportsAnalysis
rm analytics.json

Remove the demo analysis configuration.

Next, we will learn Inspect S3 event notification configuration.

Official AWS CLI reference