CertNote/ Commute Study Notes
Roadmap
KOEN
CLF-C02 · FoundationalCloud Practitioner - Foundational
DVA-C02 · AssociateDeveloper - Associate
SAA-C03 · AssociateSolutions Architect - Associate
SOA-C02 · AssociateCloudOps Engineer - Associate
SAP-C02 · ProfessionalSolutions Architect - Professional
DOP-C02 · ProfessionalDevOps Engineer - Professional
Linux Master 2 · 2급KAIT Linux Master - Level 2
SCS-C03 · SpecialtySecurity - Specialty
Linux Master 1 · 1급KAIT Linux Master - Level 1
MLA-C01 · AssociateMachine Learning Engineer - Associate
AIF-C01 · FoundationalAI Practitioner - Foundational
DEA-C01 · AssociateData Engineer - Associate
  • Week 1
    • 1.What Is Data Engineering
    • 2.Batch vs Streaming
    • 3.A Bird's-Eye View of AWS Data Services
    • 4.Data Formats and Modeling
    • 5.Week 1 Comprehensive Review
  • Week 2
  • Week 3
  • Week 4
  • Week 5
  • Week 6
    • 1.S3 Data Lake Layout and Partitioning Strategy
    • 2.Centralized Permission Management with AWS Lake Formation
    • 3.Open Table Formats: Iceberg, Hudi, Delta Lake
    • 4.S3 Storage Management and Cost Optimization
    • 5.Week 6 Review: Data Lakes
  • Week 7
  • Week 8
  • Week 9
  • Week 10
MLS-C01 · SpecialtyMachine Learning - Specialty
SQLD · 개발자SQL Developer (SQLD)

© CertNote · 주간랩스

  • About
  • Changelog
  • Contact
  • Terms
  • Privacy
← DEA-C01/Week 6/Day 4

Based on the DEA-C01 exam guide·Report an error

DEA-C01· AssociateWeek 6 · Day 4~35 min read

Day 4 - S3 Storage Management and Cost Optimization

📌 Key Takeaways

  • A storage class is a trade of storage price ↔ retrieval fees, minimum storage duration, and retrieval latency. Keeping frequently read data in IA or Glacier actually costs more because of retrieval fees.
  • The minimum storage durations are 30 days for Standard-IA and One Zone-IA, 90 days for Glacier Instant and Flexible Retrieval, and 180 days for Deep Archive. If you delete or move objects before that, you are billed for the remaining period.
  • Use lifecycle policies to automate transitions and expiration. Rules that clean up incomplete multipart uploads and expire noncurrent versions are needed on almost every bucket.
  • When the access pattern is unknown or changing, use Intelligent-Tiering (no retrieval fees, a per-object monitoring fee); when the pattern is clear, lifecycle transitions are cheaper.
  • Objects moved to Glacier Flexible Retrieval or Deep Archive cannot be read until restored. Athena skips these objects. If you need immediate queries, go down only as far as Glacier Instant Retrieval.

Where the Cost Comes From

A data lake grows over time, and the access frequency of its data falls over time. S3 charges come in four parts, and storage classes change the ratio among the four.

Billing itemUnitHow to reduce
StorageGB-month (price per class)Compression and columnar formats, transition to lower classes, expiration
RequestsRequest count (PUT, GET, LIST, lifecycle transition requests)Larger files, merge small files
RetrievalGB read out (IA and Glacier classes)Keep frequently read data in Standard
Early deletionRemaining days of the minimum storage durationDo not send short-lived data to lower classes

On top of this, there are two cases with per-object charges: the monitoring and automation fee of Intelligent-Tiering, and the per-object metadata overhead of Glacier Flexible Retrieval and Deep Archive. Both are proportional to the number of objects, so they become a problem in lakes with many small files.

S3 Storage Classes

ClassDesigned forAvailability (design)AZsMinimum durationMinimum billable sizeRetrieval
S3 StandardFrequent access (more than once a month)99.99%3 or moreNoneNoneImmediate, no retrieval fee
S3 Intelligent-TieringUnknown or changing patterns99.9%3 or moreNoneNoneImmediate (except the optional archive tiers), no retrieval fee
S3 Standard-IAInfrequent access (about once a month), needed immediately99.9%3 or more30 days128KBImmediate, per-GB retrieval fee
S3 One Zone-IARegenerable, non-critical data99.5%130 days128KBImmediate, per-GB retrieval fee
S3 Glacier Instant RetrievalAbout once a quarter, needed immediately99.9%3 or more90 days128KBMilliseconds, per-GB retrieval fee
S3 Glacier Flexible RetrievalAbout once a year, minutes to hours acceptable99.99% (after restore)3 or more90 daysNot applicable (40KB overhead per object)Restore required
S3 Glacier Deep ArchiveLess than once a year, long-term regulatory retention99.99% (after restore)3 or more180 daysNot applicable (40KB overhead per object)Restore required
  • Durability is the same for all classes at 99.999999999% (11 9's). What differs between classes is availability and the number of AZs. Only One Zone-IA is stored in a single AZ, so if that AZ is physically lost, the data is lost.
  • "Minimum billable size of 128KB" means objects smaller than that are also billed as 128KB. Sending files of a few KB to IA can cost more than Standard.
  • For Glacier Flexible Retrieval and Deep Archive, 40KB is added per object. 32KB is billed at the Glacier rate and 8KB at the Standard rate (this is the cost of keeping object names and metadata available for real-time listing).

💡 Related Theory: The IA (Infrequent Access) classes lower the storage price but charge a per-GB retrieval fee when reading. So the break-even depends on "how often and how much you read." If you move Curated data, which dashboards scan every day, down to IA, the retrieval fees exceed the storage savings. Choose the class by access frequency, not by the age of the data.

Restoring from Archive Tiers

Objects in Glacier Flexible Retrieval and Deep Archive cannot be read in real time. You use RestoreObject to request a temporary copy, wait, and then read it only for the number of days you specified.

Restore optionGlacier Flexible RetrievalGlacier Deep Archive
Expedited1 to 5 minutesNot offered
Standard (default)3 to 5 hoursWithin 12 hours
Bulk5 to 12 hoursWithin 48 hours
# Request a Bulk restore of a Deep Archive object and keep the temporary copy for 7 days
aws s3api restore-object \
  --bucket acme-datalake-raw-prod \
  --key raw/orders/dt=2023-01-15/part-0000.json.gz \
  --restore-request '{"Days": 7, "GlacierJobParameters": {"Tier": "Bulk"}}'
  • Even after a restore, the object's storage class stays the same. During the restore period you pay the archive charge + the Standard charge for the temporary copy together.
  • Bulk restore for Flexible Retrieval is free, and Expedited carries a premium fee. Expedited can be rejected when demand is high, so if you definitely need it, buy provisioned capacity.
  • When there are tens of millions of objects, the restore requests themselves are a chore. Use S3 Batch Operations to request them all at once.
  • To permanently change the class back, you must restore and then copy to the desired class. Lifecycle transitions flow only downward.

Storage Mapping by Data Lake Zone

ZoneAccess patternRecommendation
RawRarely, only during reprocessing, but needed immediately thenStandard → after some period Standard-IA or Glacier Instant Retrieval
CleanRead regularly by ETLStandard or Intelligent-Tiering
CuratedRead often by BI and dashboardsStandard
Long-term regulatory retention (raw logs, etc.)Almost never read, latency acceptableGlacier Deep Archive
  • For data that may still be queried with Athena or Redshift Spectrum, go down only as far as Glacier Instant Retrieval. Objects moved to Flexible Retrieval or Deep Archive are skipped by Athena without an error, causing the incident where "old partitions silently drop out of the results."
  • To read restored objects with Athena, you must set the table property read_restored_glacier_objects to true (engine version 3, Hive tables). Athena does not perform the restore itself.
  • Do not archive or expire the data files of open table formats (such as Iceberg) with lifecycle rules. If the files the metadata points to cannot be read, the table breaks.

Lifecycle Policies

Lifecycle rules transition or expire objects according to their age. There is one configuration per bucket, with up to 1,000 rules.

{
  "Rules": [
    {
      "ID": "raw-tiering",
      "Filter": { "Prefix": "raw/" },
      "Status": "Enabled",
      "Transitions": [
        { "Days": 30,  "StorageClass": "STANDARD_IA" },
        { "Days": 90,  "StorageClass": "GLACIER" },
        { "Days": 365, "StorageClass": "DEEP_ARCHIVE" }
      ],
      "Expiration": { "Days": 2555 },
      "NoncurrentVersionExpiration": { "NoncurrentDays": 30 }
    },
    {
      "ID": "cleanup-incomplete-uploads",
      "Filter": {},
      "Status": "Enabled",
      "AbortIncompleteMultipartUpload": { "DaysAfterInitiation": 7 }
    }
  ]
}
aws s3api put-bucket-lifecycle-configuration \
  --bucket acme-datalake-raw-prod \
  --lifecycle-configuration file://lifecycle.json

Transitions follow a waterfall model. They only go from top to bottom.

Standard → Standard-IA → Intelligent-Tiering → One Zone-IA → Glacier Instant Retrieval
        → Glacier Flexible Retrieval → Glacier Deep Archive
(skipping from an upper stage to a lower stage is possible; going back up is not)

The constraints you run into when writing rules are as follows.

ConstraintDetails
FiltersPrefix, object tags, object size (ObjectSizeGreaterThan/ObjectSizeLessThan), and combinations of them
Small objectsObjects smaller than 128KB are not transitioned to any class by default. This is because the transition request cost exceeds the savings. You can change this with a size filter
Minimum storage durationWithin one rule you cannot create a setting that moves to the next class before meeting the minimum storage duration (for example, if you sent it to Glacier Instant Retrieval on day 4, the Deep Archive transition is after day 94)
Date calculationDays are added to the creation time and rounded up to midnight (UTC) of the next day
Billing timingGlacier transitions are asynchronous, but billing at the target class rate starts from the day the rule condition is met
  • The 128KB default behavior changed in September 2024. Before that, even objects smaller than 128KB were transitioned to Glacier Flexible Retrieval and Deep Archive. Older materials may explain the old behavior.
  • A transition is one request per object. If you transition hundreds of millions of small files, the transition request cost exceeds the savings. Merge first, then move down.

Lifecycle in Versioned Buckets

In a bucket with versioning enabled, the meaning of "expiration" changes.

ActionWithout versioningWith versioning
ExpirationPermanently deletes the objectAdds a delete marker. Existing versions remain as noncurrent versions
NoncurrentVersionExpirationNo effectPermanently deletes noncurrent versions
NoncurrentVersionTransitionNo effectTransitions noncurrent versions to another class
ExpiredObjectDeleteMarkerNot applicableRemoves delete markers with no versions left
  • If you set only Expiration on a versioned bucket, the charges do not go down. The data stays as noncurrent versions. Set NoncurrentVersionExpiration together with it.
  • With NewerNoncurrentVersions you can specify "keep the most recent N noncurrent versions" (1 to 100).
  • Expiration rules do not delete incomplete multipart uploads. A separate AbortIncompleteMultipartUpload rule is needed. This action and ExpiredObjectDeleteMarker cannot be used in rules that have a tag filter.

⚠️ Pitfall: If you enable versioning on an ETL output bucket that is overwritten often, the entire previous output piles up as noncurrent versions every time a job runs. The console shows only the latest objects, so it becomes "the data is 100GB but the bill is for several TB." Versioning + a noncurrent version expiration rule come as a set.

S3 Intelligent-Tiering

For data whose access pattern is hard to predict, S3 watches per-object access and moves tiers. Even when the tier changes, the storage class stays Intelligent-Tiering.

Access tierMove conditionAccess
Frequent Access (automatic)Default. Right after upload or transitionImmediate
Infrequent Access (automatic)30 consecutive days without accessImmediate
Archive Instant Access (automatic)90 consecutive days without accessImmediate
Archive Access (optional)90 or more days without access (configurable up to 730 days)Restore required, same performance as Flexible Retrieval
Deep Archive Access (optional)180 or more days without access (configurable up to 730 days)Restore required, same performance as Deep Archive
  • All three automatic tiers are read immediately. If you read an object that was in a lower tier, it returns to Frequent Access.
  • There are no retrieval fees and no minimum storage duration. Instead, you pay a monthly per-object monitoring and automation fee.
  • Objects smaller than 128KB are not monitored and always stay in the Frequent Access tier. It has no effect on prefixes with only small files.
  • The optional archive tiers are used only if you turn them on, and when on, objects in that tier must be restored to be read. Do not turn them on for data queried with Athena.
  • GetObject counts as an access, but HeadObject, listing, and tag lookups do not count as access.
# Enable the optional archive tiers for Intelligent-Tiering objects in a bucket
aws s3api put-bucket-intelligent-tiering-configuration \
  --bucket acme-datalake-clean-prod \
  --id archive-config \
  --intelligent-tiering-configuration '{
    "Id": "archive-config",
    "Status": "Enabled",
    "Tierings": [
      {"Days": 90, "AccessTier": "ARCHIVE_ACCESS"},
      {"Days": 180, "AccessTier": "DEEP_ARCHIVE_ACCESS"}
    ]
  }'
Decision criterionLifecycle transitionIntelligent-Tiering
Access patternClearly declines with ageUnknown, irregular, or changing
When read againIA and Glacier incur retrieval feesNo retrieval fee, automatically returns to a higher tier
Fixed costTransition request cost (one time)Per-object monitoring fee (monthly)
Early deletion feeYesNo
Small objectsUnder 128KB excluded from transitions by defaultUnder 128KB have no tier movement

Intelligent-Tiering is "insurance that removes the penalty for a wrong prediction." If the pattern is certain (it is almost never viewed after 30 days), moving down directly with a lifecycle rule is cheaper, without the monitoring fee that is the premium. If the pattern is uncertain, the risk of moving to IA and then being read again and paying retrieval fees is greater, so Intelligent-Tiering is better.

Cost Visibility Tools

ToolQuestion it answersOutput
S3 Storage LensWhere has how much accumulated at the organization, account, bucket, and prefix level, and how much is in incomplete multipart uploads and noncurrent versionsDashboard, metrics export
S3 InventoryWhich objects are in the bucket, with what class, size, and encryption stateDaily or weekly listing files (CSV, ORC, Parquet) → analyze with Athena
Storage class analysisWhen is it good to move this data down to Standard-IAAccess pattern analysis results
  • Inventory is a way to get the object list without calling ListObjects hundreds of millions of times. If you extract the "average object size per prefix" with Athena, the location of the small files problem is revealed.
  • Storage class analysis helps with the decision between Standard and Standard-IA. It keeps you from setting lifecycle days by gut feeling.

The fundamental order of savings is ① reduce the stored volume itself (Parquet + compression) → ② reduce the number of objects (compaction) → ③ delete what is not needed (expiration, noncurrent versions, incomplete uploads) → ④ send what remains to the right class. If you start from ④, you run into the transition request cost and minimum billable size of small files.

Symptom → Cause → Action

SymptomCauseAction
Charges rose after moving to IAFrequent reads incur retrieval fees, or objects under 128KB are billed as 128KBMove back to Standard, check the access pattern
Request charges spiked after lifecycle transitionsMass transition of small objectsTransition after compaction, size filter
Expiration rule set but capacity unchangedNoncurrent versions in a versioned bucketAdd NoncurrentVersionExpiration
Charges are larger than the sum of the object listIncomplete multipart uploads, noncurrent versionsAbortIncompleteMultipartUpload, check with Storage Lens
Older dates are missing from Athena resultsThose objects were transitioned to Glacier Flexible Retrieval or Deep ArchiveRestore then read_restored_glacier_objects; afterwards go down only to Instant Retrieval
Extra charge for data deleted within a monthMinimum storage duration not metKeep short-lived data in Standard
Intelligent-Tiering but no savingsObjects are under 128KBMerge, then apply

Exam Clue → Answer Lookup

Clue in the questionAnswer
"The access pattern cannot be predicted / automatically without operational burden"Intelligent-Tiering
"Almost never accessed after 30 days (clear pattern)"Lifecycle transition
"Read rarely, but within milliseconds when read"Standard-IA or Glacier Instant Retrieval (the latter if about once a quarter)
"Cheapest for regenerable data, immediate access"One Zone-IA
"7 to 10 years regulatory retention, half a day to restore is fine"Glacier Deep Archive
"Must retrieve from archive within minutes"Glacier Flexible Retrieval + Expedited
"Hidden cost of failed large uploads"AbortIncompleteMultipartUpload
"Storage cost of a versioned bucket keeps growing"NoncurrentVersionExpiration
"Identify which buckets and prefixes spend the cost across the whole organization"S3 Storage Lens
"Analyze the per-object class and size list with SQL"S3 Inventory + Athena

Tomorrow we tie this week's four topics together in a single lake operations scenario for review.

📖 Glossary

  • Storage class: An S3 storage tier whose storage price varies by access frequency and retrieval latency.
  • Retrieval fee: A per-GB charge when reading out data in the IA and Glacier classes.
  • Minimum storage duration: The period before which deleting or transitioning is billed for the remaining period. It is 30, 90, or 180 days depending on the class.
  • Lifecycle policy: A bucket-level set of rules that transition or delete objects according to their age.
  • Transition and expiration: Moving to another storage class, and deleting.
  • Noncurrent version: An object version in a versioned bucket that is no longer the latest because it was overwritten or deleted. Charges continue.
  • Delete marker: A marker added when a delete request is made in a versioned bucket. It only makes the object look absent and does not erase the data.
  • Incomplete multipart upload: Parts left behind by a multipart upload that was never completed. They do not appear in listings but incur storage charges.
  • Restore: The operation of creating a temporary copy of an archived object so it can be read for a set period.
  • S3 Inventory: A feature that periodically exports a list of a bucket's objects and metadata as files.

📝 Practice Questions

Click a choice to reveal the answer and explanation.

Question 1

Which S3 storage class is the most suitable when access patterns are hard to predict and you want objects to be moved between tiers automatically, per object, without retrieval fees?

Question 2

After placing frequently read Curated zone data in Standard-IA to save cost, the cost actually increased. What is the most likely cause?

Question 3

Which S3 lifecycle rule is recommended for almost every bucket and removes hidden costs?

Question 4

When the access pattern is clearly predictable as "almost never accessed after 30 days," which is the correct reason it can be cheaper than Intelligent-Tiering?

Question 5

Which S3 feature visualizes storage usage and savings opportunities (unused IA, incomplete uploads, and so on) at the account, bucket, and prefix level to find cost optimization targets?

PreviousOpen Table Formats: Iceberg, Hudi, Delta LakeWeek 6 · Day 3Next Week 6 Review: Data LakesWeek 6 · Day 5

Official references

  • DEA-C01 official exam page(opens in a new tab)
  • Amazon S3 documentation(opens in a new tab)
  • Amazon Athena documentation(opens in a new tab)

On this page

  • Key Takeaways
  • Where the Cost Comes From
  • S3 Storage Classes
  • Restoring from Archive Tiers
  • Storage Mapping by Data Lake Zone
  • Lifecycle Policies
  • Lifecycle in Versioned Buckets
  • S3 Intelligent-Tiering
  • Cost Visibility Tools
  • Symptom → Cause → Action
  • Exam Clue → Answer Lookup
  • Glossary
  • Practice Questions