AWS Storage Gateway
A VM you drop into the data centre that speaks the protocols your existing servers already speak — NFS, SMB, iSCSI — and quietly turns the far end into S3. On-prem keeps a local cache for latency; the bulk of the data lives in the cloud. Backup, DR, tiered storage, and "we are out of floor space" all end up here.
Một VM đặt trong trung tâm dữ liệu, nói đúng những giao thức mà server hiện có đang dùng — NFS, SMB, iSCSI — rồi âm thầm biến đầu bên kia thành S3. Phía on-prem giữ một cache cục bộ cho độ trễ; phần lớn dữ liệu nằm trên cloud. Backup, DR, lưu trữ phân tầng, và cả chuyện "hết chỗ đặt tủ" đều dẫn về đây.
The whole page really reduces to one question: what protocol does the client speak? That single fact picks the gateway type, and the gateway type decides what lands in AWS.
Cả trang này thật ra chỉ gom về một câu hỏi: client nói giao thức gì? Chỉ dữ kiện đó chọn ra loại gateway, và loại gateway quyết định thứ gì rơi xuống phía AWS.
Reach for it / not the right toolKhi nào dùng / khi nào không
Reach for Storage GatewayChọn Storage Gateway
- An on-prem application cannot be changed and only knows NFS, SMB or iSCSI — but the data needs to end up in AWS.Một ứng dụng on-prem không sửa được và chỉ biết NFS, SMB hay iSCSI — nhưng dữ liệu phải nằm ở AWS.
- The tape library is at end of life and the backup software must stay. Tape Gateway swaps the media, not the process.Thư viện băng từ đã hết đời và phần mềm backup phải giữ nguyên. Tape Gateway thay phương tiện lưu, không thay quy trình.
- Bottomless tiered storage for a file share: hot files cached locally, the long tail in S3 and eventually Glacier.Lưu trữ phân tầng không đáy cho file share: file nóng cache tại chỗ, phần đuôi dài nằm ở S3 rồi Glacier.
- DR for on-prem block volumes: EBS snapshots that can restore either on-prem or as an EBS volume in a recovery VPC — see Disaster Recovery.DR cho volume block on-prem: EBS snapshot có thể phục hồi cả tại on-prem lẫn thành volume EBS trong VPC dự phòng — xem Disaster Recovery.
- You want on-prem output to become ordinary S3 objects that Lambda, Athena and replication can act on.Bạn muốn dữ liệu sinh ra ở on-prem trở thành object S3 bình thường để Lambda, Athena và replication xử lý được.
Not the right toolKhông phải chỗ dùng
- A one-off bulk transfer of petabytes. That's Snow Family, or DataSync over the wire — a gateway is a permanent fixture, not a shipping method.Một lần chuyển hàng loạt hàng petabyte. Đó là việc của Snow Family, hoặc DataSync qua đường mạng — gateway là hạ tầng thường trực, không phải cách vận chuyển.
- A real POSIX or Windows file system in AWS for cloud workloads. Use EFS or FSx; File Gateway is object storage wearing a file share costume.Cần file system POSIX hay Windows thật trên AWS cho workload chạy trên cloud. Hãy dùng EFS hoặc FSx; File Gateway chỉ là object storage khoác áo file share.
- A database or anything latency-critical writing constantly. Every miss is a round trip to S3; the cache only saves you on the working set.Cơ sở dữ liệu hay bất cứ thứ gì ghi liên tục và nhạy độ trễ. Mỗi lần miss là một vòng đi S3; cache chỉ cứu được phần dữ liệu đang làm việc.
- Backing up AWS-native resources — EBS, RDS, DynamoDB, EFS. That's AWS Backup, and the gateway has nothing to do with it.Sao lưu tài nguyên gốc trên AWS — EBS, RDS, DynamoDB, EFS. Đó là AWS Backup, gateway không liên quan.
- Multi-site read-write sharing of the same files. Gateways don't coordinate locks with each other; only read-only replicas are safe.Chia sẻ đọc-ghi cùng bộ file giữa nhiều site. Các gateway không phối hợp khoá với nhau; chỉ bản sao chỉ đọc mới an toàn.
Which gateway — decide by protocolChọn gateway nào — quyết theo giao thức
Don't reason from the use case, reason from the wire. File shares speak NFS/SMB. Servers that want a raw disk speak iSCSI block. Backup software that wants a tape robot speaks iSCSI VTL. Three protocols, three gateways, no overlap. Đừng suy từ use case, hãy suy từ đường dây. File share nói NFS/SMB. Server muốn một ổ đĩa thô thì nói iSCSI block. Phần mềm backup muốn một robot băng từ thì nói iSCSI VTL. Ba giao thức, ba gateway, không chồng lấn.
| Client speaks…Client nói… | GatewayGateway | What it's forDùng để làm gì | Lands in AWS asỞ phía AWS thành |
|---|---|---|---|
| NFS or SMBNFS hoặc SMB | S3 File GatewayS3 File Gateway | file shares, user home directories, media libraries, on-prem apps that write filesfile share, thư mục người dùng, kho media, ứng dụng on-prem ghi ra file | S3 objects, one per file, readable by anything — Standard, IA, One Zone-IA, Intelligent-TieringObject S3, mỗi file một object, thứ gì cũng đọc được — Standard, IA, One Zone-IA, Intelligent-Tiering |
| iSCSI block — cached modeiSCSI block — chế độ cached | Volume GatewayVolume Gateway | grow a volume past the local array — capacity in the cloud, hot blocks kept localmở rộng volume vượt tủ đĩa tại chỗ — dung lượng ở cloud, block nóng giữ tại chỗ | the primary copy in S3 (AWS-managed, you never see the bucket) + EBS snapshotsbản chính nằm ở S3 (do AWS quản, bạn không thấy bucket) + EBS snapshot |
| iSCSI block — stored modeiSCSI block — chế độ stored | Volume GatewayVolume Gateway | keep full local performance, use AWS purely as off-site backup and DRgiữ nguyên hiệu năng tại chỗ, dùng AWS thuần tuý làm backup ngoài site và DR | EBS snapshots only — the live data stays on your diskschỉ là EBS snapshot — dữ liệu sống vẫn nằm trên đĩa của bạn |
| iSCSI VTL (a tape robot)iSCSI VTL (robot băng từ) | Tape GatewayTape Gateway | retire the physical tape library while keeping NetBackup / Veeam / Commvault jobs untouchedbỏ thư viện băng từ vật lý mà không đụng vào job NetBackup / Veeam / Commvault | virtual tapes in S3; ejected tapes move to the tape archive in Glacier or Deep Archivebăng ảo trong S3; băng đã eject chuyển sang kho lưu băng ở Glacier hoặc Deep Archive |
| NFS/SMB, but the consumer runs in AWSNFS/SMB, nhưng bên tiêu thụ chạy trên AWS | none — wrong shapekhông cái nào — sai hình dạng | cloud workloads that need a genuine shared file system with POSIX or NTFS semanticsworkload trên cloud cần một file system chia sẻ thật với ngữ nghĩa POSIX hoặc NTFS | EFS or FSx, filled by DataSync — not a gatewayEFS hoặc FSx, đổ dữ liệu bằng DataSync — không phải gateway |
Read it left to right and the choice makes itself. The middle column is the only thing that lives in your data centre, and the only reason it exists is the local cache.
Đọc từ trái sang phải là tự chọn được. Cột giữa là thứ duy nhất nằm trong trung tâm dữ liệu của bạn, và lý do duy nhất nó tồn tại chính là cache cục bộ.
Cached vs Stored volumes — the classic trapCached và Stored volume — cái bẫy kinh điển
The names sound interchangeable and they are not. Ask one question: where does the complete dataset physically sit? Cached → in S3. Stored → on your own disks. Everything else follows from that. Hai cái tên nghe như thay nhau được, thật ra không. Chỉ hỏi một câu: toàn bộ dữ liệu nằm vật lý ở đâu? Cached → ở S3. Stored → trên đĩa của bạn. Mọi thứ khác suy ra từ đó.
Green block = the authoritative copy. In cached mode the on-prem disk is disposable; in stored mode losing it loses data between backups.
Khối màu xanh = bản dữ liệu chính thức. Ở chế độ cached, đĩa on-prem là thứ có thể bỏ đi; ở chế độ stored, mất nó là mất dữ liệu trong khoảng giữa hai lần backup.
| Cached volumesCached volumes | Stored volumesStored volumes | |
|---|---|---|
| Primary dataDữ liệu chính | in S3; on-prem keeps only a cache of the working setnằm ở S3; on-prem chỉ giữ cache của phần đang dùng | entirely on-prem; S3 holds point-in-time snapshotstoàn bộ ở on-prem; S3 giữ snapshot theo thời điểm |
| Why you'd choose itVì sao chọn | local storage is full and you want unbounded capacity without buying an arraylưu trữ tại chỗ đã đầy và bạn muốn dung lượng không giới hạn mà không phải mua tủ đĩa | performance must stay fully local; the cloud is only there for off-site DRhiệu năng phải hoàn toàn cục bộ; cloud chỉ để làm DR ngoài site |
| Read latencyĐộ trễ đọc | low on a cache hit, round trip to S3 on a missthấp khi cache hit, đi vòng ra S3 khi miss | always local — no misses possibleluôn cục bộ — không thể có miss |
| Size ceilingGiới hạn dung lượng | 32 TiB per volume, 32 volumes → ~1 PiB per gateway32 TiB mỗi volume, 32 volume → ~1 PiB mỗi gateway | 16 TiB per volume, 32 volumes → ~512 TiB, and you must own that much disk16 TiB mỗi volume, 32 volume → ~512 TiB, và bạn phải có đủ ngần ấy đĩa |
| If the site burns downNếu site cháy rụi | data is safe in S3; stand up a new gateway and reattachdữ liệu an toàn ở S3; dựng gateway mới rồi gắn lại | you lose everything since the last snapshot — that gap is your RPOmất toàn bộ từ sau snapshot cuối — khoảng trống đó chính là RPO của bạn |
Once files are in S3, they're just objectsKhi file đã vào S3, chúng chỉ là object
This is the real reason to prefer File Gateway over any tape or block option when you have the choice: what comes out the far end is a normal S3 object, and the entire S3 ecosystem applies to it without anyone touching the on-prem app. Đây mới là lý do thật sự nên chọn File Gateway thay vì tuỳ chọn băng từ hay block khi có quyền chọn: thứ đi ra đầu bên kia là một object S3 bình thường, và cả hệ sinh thái S3 áp dụng được lên nó mà không ai phải đụng vào ứng dụng on-prem.
RefreshCache. Site B is eventually consistent with site A, and "eventually" is a number you choose.
Gateway chỉ đọc không được báo khi bucket thay đổi. Nó thấy object mới khi cache làm mới — tự động theo TTL bạn cấu hình, hoặc ngay lập tức nếu gọi RefreshCache. Site B nhất quán dần với site A, và "dần" là con số do bạn chọn.
Versioning, RefreshCache and Object LockVersioning, RefreshCache và Object Lock
Two S3 features change what the file share means. Versioning turns it into a time machine; Object Lock turns it into WORM media. Both are set on the bucket, not the gateway. Hai tính năng của S3 làm thay đổi ý nghĩa của file share. Versioning biến nó thành cỗ máy thời gian; Object Lock biến nó thành phương tiện WORM. Cả hai đặt trên bucket, không phải trên gateway.
S3 Object Versioning — restore a file, or a whole file systemS3 Object Versioning — phục hồi một file, hay cả file system
- Every modification through the share creates a new object version; the old ones stay. Restoring a single file, or rolling an entire directory tree back to yesterday, becomes an S3-side operation. Mỗi lần sửa qua share tạo ra một version object mới; các version cũ vẫn còn. Phục hồi một file, hay lùi cả cây thư mục về hôm qua, trở thành thao tác phía S3.
-
The gateway will not notice that restore. Its cache and its file listing came from the last time it looked. You must call the
RefreshCacheAPI before the share reflects reality — this is the exam's favourite detail here. Gateway sẽ không nhận ra lần phục hồi đó. Cache và danh sách file của nó lấy từ lần nhìn cuối cùng. Phải gọi APIRefreshCachethì share mới phản ánh đúng thực tế — đây là chi tiết mà đề thi thích nhất ở phần này. - Same rule for any out-of-band write: an object put by Lambda, by replication, or by a person in the console is invisible to the share until a refresh. Luật y hệt cho mọi thao tác ghi ngoài luồng: object do Lambda đặt vào, do replication đưa tới, hay do người thao tác trên console, đều vô hình với share cho tới khi làm mới.
S3 Object Lock — WORM through a file shareS3 Object Lock — WORM qua một file share
- Object Lock on the bucket gives the File Gateway Write Once Read Many behaviour — the compliance answer when a regulator says records must be immutable for N years. Object Lock trên bucket cho File Gateway hành vi Write Once Read Many — đáp án về tuân thủ khi cơ quan quản lý yêu cầu hồ sơ phải bất biến trong N năm.
- A client modifying or renaming a file doesn't break the lock: the gateway writes a new object version, prior versions are untouched, and the locked original stays exactly as it was. Client sửa hay đổi tên file không phá được khoá: gateway ghi ra một version object mới, các version trước không bị đụng, và bản gốc bị khoá vẫn nguyên như cũ.
- Object Lock requires versioning enabled and is best set when the bucket is created. It cannot be casually switched on for an existing production share — plan it up front. Object Lock đòi bật versioning và tốt nhất là đặt ngay khi tạo bucket. Không thể bật bừa cho một share đang chạy — phải tính từ đầu.
Things that catch you outNhững chỗ dễ vấp
- You cannot write directly to Glacier through a File Gateway. Supported classes are Standard, Standard-IA, One Zone-IA and Intelligent-Tiering. Getting to Glacier is always a lifecycle policy after the fact — and objects in Glacier are no longer readable through the share without a restore. Không thể ghi thẳng vào Glacier qua File Gateway. Các class được hỗ trợ là Standard, Standard-IA, One Zone-IA và Intelligent-Tiering. Xuống được Glacier luôn phải qua lifecycle policy về sau — và object đã ở Glacier thì không đọc được qua share nếu chưa restore.
- The gateway needs local disks you provision: a cache disk and, for Volume and Tape gateways, an upload buffer. Fill the upload buffer and writes stall or the share goes read-only. Alarm on it in CloudWatch before it bites. Gateway cần đĩa cục bộ do bạn cấp: một đĩa cache, và với Volume/Tape gateway thì thêm upload buffer. Đầy upload buffer là ghi bị nghẽn hoặc share chuyển sang chỉ đọc. Hãy đặt cảnh báo trong CloudWatch trước khi nó cắn.
- File Gateway is not a POSIX file system. There's no shared file locking across gateways, hard links don't survive, and two gateways writing the same prefix will overwrite each other. One writer per prefix, always. File Gateway không phải file system POSIX. Không có khoá file dùng chung giữa các gateway, hard link không tồn tại, và hai gateway cùng ghi vào một prefix sẽ ghi đè lẫn nhau. Luôn luôn một người ghi cho mỗi prefix.
- Volume Gateway's S3 storage is AWS-managed and invisible — you don't get a bucket, you can't browse it, and you can't run Athena over it. Only File Gateway gives you objects you own. If a question wants the data usable in AWS, it's File Gateway. Phần S3 của Volume Gateway là do AWS quản và vô hình — bạn không có bucket, không duyệt được, không chạy Athena lên được. Chỉ File Gateway mới cho bạn object thuộc về mình. Nếu đề muốn dữ liệu dùng được trên AWS thì đó là File Gateway.
- SMB shares need Active Directory for per-user authentication; guest access exists but is a single shared password. NFS shares authorise by client IP, not by user — plan the network accordingly. Share SMB cần Active Directory để xác thực theo người dùng; có chế độ guest nhưng chỉ là một mật khẩu dùng chung. Share NFS phân quyền theo IP client, không theo người dùng — hãy thiết kế mạng cho phù hợp.
- Restoring a stored volume in AWS means taking its EBS snapshot and creating an EBS volume in a recovery VPC. That's a real DR play — but the RPO is your snapshot schedule, not zero. Phục hồi một stored volume trên AWS nghĩa là lấy EBS snapshot của nó rồi tạo volume EBS trong VPC dự phòng. Đó là một kịch bản DR thật — nhưng RPO bằng lịch snapshot của bạn, không phải bằng không.
Exam reflexesPhản xạ khi thi
| The question says…Đề nói… | AnswerTrả lời |
|---|---|
| "On-prem app writes files over NFS/SMB, data must end up in S3, app can't change""Ứng dụng on-prem ghi file qua NFS/SMB, dữ liệu phải vào S3, không sửa được ứng dụng" | S3 File Gateway — files become objects, local cache for latencyS3 File Gateway — file thành object, cache cục bộ để giảm độ trễ |
| "Local storage is running out, keep low-latency access to recent data""Lưu trữ tại chỗ sắp hết, vẫn cần truy cập nhanh dữ liệu gần đây" | Volume Gateway, cached volumes — primary data in S3Volume Gateway, cached volumes — dữ liệu chính ở S3 |
| "Entire dataset must stay on-premises for performance, with off-site backup""Toàn bộ dữ liệu phải ở on-prem vì hiệu năng, kèm backup ngoài site" | Volume Gateway, stored volumes — scheduled EBS snapshots to S3Volume Gateway, stored volumes — EBS snapshot theo lịch lên S3 |
| "Retire the tape library but keep the existing backup software and process""Bỏ thư viện băng từ nhưng giữ nguyên phần mềm và quy trình backup" | Tape Gateway — VTL over iSCSI, tapes in S3, archive in GlacierTape Gateway — VTL qua iSCSI, băng ở S3, lưu trữ ở Glacier |
| "Files must go straight to Glacier to save cost""File phải vào thẳng Glacier cho rẻ" | Not possible through the gateway — write to a supported class, then lifecycle to GlacierKhông làm được qua gateway — ghi vào class được hỗ trợ rồi dùng lifecycle xuống Glacier |
| "We restored an old version in S3 but the file share still shows the old listing""Đã phục hồi version cũ trên S3 mà file share vẫn hiện danh sách cũ" | Call RefreshCache on the gateway — it doesn't watch the bucketGọi RefreshCache trên gateway — nó không theo dõi bucket |
| "Records written from on-prem must be immutable / WORM for compliance""Hồ sơ ghi từ on-prem phải bất biến / WORM để tuân thủ" | File Gateway onto a bucket with S3 Object Lock + versioningFile Gateway trỏ vào bucket có S3 Object Lock + versioning |
| "Second office needs the same files, read-only""Văn phòng thứ hai cần cùng bộ file, chỉ đọc" | A second File Gateway on the same bucket as a read-only shareMột File Gateway thứ hai trên cùng bucket, dạng share chỉ đọc |