Skip to main content

Using Amazon S3 as the Central Data Repository

This chapter covers the end-to-end process of migrating data from on-premises Hadoop environments (HDFS, relational databases, and streaming sources) to Amazon S3 on AWS. The assumed starting point is a traditional Hadoop deployment — whether Cloudera (CDH/CDP), Hortonworks (HDP), MapR, or a custom Apache Hadoop distribution.

The target architecture uses Amazon S3 as the central data repository, with data stored in open formats (Apache Parquet, Apache ORC, or Apache Iceberg tables) and cataloged in AWS Glue Data Catalog.

HDFS vs Amazon S3 — Key Behavioral Differences

When migrating from HDFS to Amazon S3, understanding the behavioral differences is critical to avoid runtime failures and performance issues. S3 is an object store, not a POSIX filesystem — while the Hadoop FileSystem API abstracts most differences, some behaviors change fundamentally.

BehaviorHDFSAmazon S3Migration Impact
ConsistencyStrong (single-writer)Strong read-after-write (since Dec 2020)No action needed
RenameAtomic, O(1)Copy + delete, O(n)Use S3-optimized committers or Iceberg
AppendSupportedNot supportedWrite new files instead
DirectoriesReal directories, atomicSimulated via key prefixesAvoid directory-atomicity patterns
File listingFast (inode-based)Slower (prefix scan)Use Iceberg metadata for file discovery
PermissionsPOSIX rwx, HDFS ACLsIAM policies, bucket policiesRedesign with IAM/Lake Formation
LocalityData-local computeNetwork-accessed (10+ Gbps)Locality less critical on AWS
Durability3x replication11 9s (automatic)No action — S3 exceeds HDFS
Cost modelHardware (fixed)Pay per GB + requestsOptimize: fewer small files, right storage class

Critical code patterns to address:

1. Output committers — Replace FileOutputCommitter algorithm 1 with the EMRFS S3-optimized committer (default on EMR 6.x–7.9), the S3A Magic Committer (default on EMR 7.10+ with S3A), or use Iceberg tables which handle commits atomically via their own metadata-based protocol.

2. Temp files and scratch directories — Workflows that write temp files to HDFS should use instance storage (local HDFS) for scratch and write final output to S3.

3. Small files — HDFS handles millions of small files via NameNode memory. On S3, small files incur per-request costs and slower listing. Compact files to 128 MB–1 GB; use S3 Tables auto-compaction for ongoing management.

4. Hive INSERT OVERWRITE — On HDFS, this atomically replaces a partition directory. On S3, it's a multi-step operation. Use Iceberg's INSERT OVERWRITE for atomic partition replacement via metadata.