Course outline

12.3

Storage Gateway: File, Volume and Tape

Exposing cloud storage on-premises over NFS, SMB and iSCSI, cached vs stored volumes, and virtual tapes.

24 min Reading + animations

Tip: tap or hover any dotted-underlined term to see what it means.

By the end of this lesson you will be able to

  • Explain why companies run hybrid storage, place every AWS storage service on the block / file / object map, and say why S3 needs a gateway on premises when EFS does not.
  • Describe the Storage Gateway family (S3 File Gateway, FSx File Gateway, Volume Gateway in cached and stored mode, Tape Gateway): the protocol each speaks on premises, where the data lives in AWS, and what AWS can do with it.
  • Predict how a gateway’s local cache and upload buffer behave: write-back, cache hits and misses, eviction, a full cache during a link outage, stale listings, and why dirty data matters.
  • Follow a virtual tape from creation to Glacier Deep Archive and back, with retrieval times, read-only retrieved tapes, WORM tapes and Tape Retention Lock.
  • Deploy and run a gateway: VM or EC2 host (and the end of the hardware appliance), activation, private paths over Direct Connect, bandwidth schedules, monitoring, high availability and pricing.
  • Pick the right answer in exam scenarios: S3 File Gateway vs FSx for Windows File Server, cached vs stored volumes, Tape Gateway, DataSync.

#Hybrid cloud for storage

#Why part of the storage stays on premises

AWS pushes hybrid cloud: part of your infrastructure runs in AWS, part stays in your own building. That is not a failure to migrate. It happens for ordinary reasons:

  • Long migrations. A bank with 300 applications cannot move them all in one year. For years, some servers stay in the data centre and still need storage.
  • Security requirements. Some systems must stay inside the building, for example the core banking servers, while their backups may go to the cloud.
  • Compliance requirements. A regulator may require that certain records are kept on premises, or that a copy exists outside the city.
  • IT strategy. A company may decide to keep its factories running on local servers, so production never stops when the internet does, but use the cloud for backup, archive and analytics.

Lesson 10.11 (paths to S3: the bulk paths) met S3 File Gateway as “path 6” and saw the rest of the family in one paragraph each. This lesson is the deep dive: how the cache really behaves, the two volume modes, the life of a virtual tape, how a gateway is deployed and what goes wrong.

#The cloud-native storage map: block, file, object

Before choosing a gateway, place every storage service on the map. There are three ways to store data, and each speaks a different language:

TypeWhat the client seesHow it talksAWS services
BlockA raw disk of numbered blocks; the client formats it with its own file system (NTFS, ext4)Disk commands: SCSI, NVMe; over the network iSCSIAmazon EBS (lesson 5.1), EC2 instance store (lesson 5.3)
FileFolders and files with names, owners and permissions, shared by many clientsNFS (Linux), SMB (Windows)Amazon EFS (lesson 5.4), Amazon FSx (lesson 12.2)
ObjectWhole objects with a key and metadata in a flat bucket, no folders really, no partial editsAn HTTPS API (PUT, GET, list requests)Amazon S3, S3 Glacier classes (chapter 10)

Now the problem is easy to see. A Linux server on premises can mount EFS directly over NFS (through Direct Connect or a VPN), because EFS speaks NFS. S3 does not. S3 is a proprietary object API: a file server, a database or backup software built for disks and shares cannot write to it without changes. So how do you expose S3 data on premises, or put on-premises data into S3 without rewriting the applications? AWS Storage Gateway.

#Three words first: NFS, SMB and iSCSI

The owner’s notes explain the first two with office scenes (lesson 10.11 has them in full):

  • NFS (Network File System) is the Linux and Unix way of sharing files. Five Linux computers in an office: a folder on computer 1 is used by the other four as if it were on their own disk.
  • SMB (Server Message Block) is the Windows way. Right-click a folder, Properties → Sharing → Share: that is SMB. A central Windows server shares folders and printers with every PC.
  • Microsoft Active Directory (AD) is the central list of users for a Windows network. In a company of 500 staff, nobody sets a password on each PC. AD keeps all 500 usernames and passwords; when someone logs in at any PC, the PC asks AD “is this person real?”, and AD also decides who may open which folder or use which printer.

The notes never explain the third word, and Volume and Tape Gateway depend on it:

  • SCSI is the old, standard language a computer uses with its disks and tape drives: “read blocks 1,000 to 1,007”, “write these blocks”, “load the tape in slot 4”.
  • iSCSI sends the same SCSI commands over an IP network. The server runs an initiator; the storage offers a target. Once connected, the server sees a new local disk (or a tape drive) and does not know or care that it is across the network. Optional CHAP authentication makes the initiator prove it knows a shared secret.

#What Storage Gateway is

#A bridge with a local cache

AWS Storage Gateway is a hybrid storage service: a bridge between on-premises data and cloud data. You run a small gateway appliance (a VM) in your building. Your servers talk to it with the protocols they already know (NFS, SMB or iSCSI), and it talks to AWS over HTTPS. The data ends up in AWS storage (S3, S3 Glacier, EBS snapshots), while a local cache on the appliance keeps recently used data close for low latency.

The slides list four use cases, and each gateway type serves some of them:

  • Disaster recovery: volume snapshots in AWS can be restored to EC2 if the building is lost.
  • Backup and restore: Tape Gateway and volume snapshots replace off-site tapes.
  • Tiered storage: hot data in the local cache, everything in S3, cold data moved to Glacier by lifecycle rules.
  • On-premises cache and low-latency file access: users open recent files at local speed while the master copy is in AWS.

#The family at a glance

The notes say there are three types. Today there are four, one of them closed to new customers:

GatewayOn premises it looks likeProtocolData lives in AWS asCan AWS services read the data?
Amazon S3 File GatewayA file server (NAS)NFS v3 / v4.1, SMB v2 / v3One S3 object per file, in your bucketYes: plain objects, usable by Athena, Lambda, replication, lifecycle
Amazon FSx File GatewayA local cache of a Windows shareSMBFiles in FSx for Windows File ServerYes, through FSx. Closed to new customers since 28 October 2024
Volume GatewayDisks (block volumes)iSCSIVolume data in S3 (managed by the service, not your bucket), backups as EBS snapshotsOnly via snapshots: restore them as EBS volumes
Tape GatewayA tape library: media changer + tape drives (a VTL)iSCSIVirtual tapes in S3, archived tapes in S3 Glacier Flexible Retrieval or Deep ArchiveNo: tape data is read back through the backup software

Two facts in this table catch people out:

  • Only S3 File Gateway writes into your own bucket as normal objects. Volume and tape data is stored in S3 by the service; you cannot open it in the S3 console.
  • Volume Gateway backs up as EBS snapshots in both modes, cached and stored. The notes mention snapshots only for stored volumes.

#Amazon S3 File Gateway in depth

#The exam question from the notes

The notes work through a classic question: a company has a large dataset in S3, and on-premises servers must use it with their normal file protocols. The answer is S3 File Gateway, and the reasoning is worth knowing step by step:

  1. S3 is object storage that works over HTTP and HTTPS (a REST API). The office servers do not speak that API; they speak local file sharing, NFS or SMB.
  2. You install File Gateway (a VM) in the office.
  3. It talks NFS or SMB with the local servers.
  4. The servers think they are reading and writing a local disk or NAS.
  5. Behind the scenes, File Gateway translates each file into an S3 object and stores it in the bucket, or fetches it back, over the internet (or Direct Connect).
  6. To control who may see or change the files, it can join the office’s Microsoft AD (for SMB shares).

The notes sum up its biggest advantage: the data really lives in S3 (unlimited and cheap), but the local servers believe it is local.

#The cache: write-back and read-through

The cache is what makes a File Gateway feel local, and most of its problems come from it too. Lesson 10.11 showed a hit and a miss; here is the full behaviour.

  • Writes are write-back. A write is stored on the cache disk and acknowledged at once. The data is now dirty: it exists only on premises. The gateway uploads it to S3 asynchronously, and only the changed parts of a file travel when it is edited.
  • Reads are read-through. A read is served from the cache if the data is there (a hit). If not (a miss), the gateway fetches only the requested parts from S3, returns them and keeps them in the cache.
  • Eviction is least recently used, and clean only. When the cache is full, the gateway removes the least recently used data that is already in S3. It never evicts dirty data, because that would lose it.
  • Size it for both. The cache must hold the hot working set (what people read every week) plus all dirty data that can pile up: a busy day on a slow link, or an outage. Cache size per gateway is 150 GiB minimum, 64 TiB maximum; add disks, never resize a disk already in use.
  • Watch three CloudWatch metrics. CachePercentDirty (how much is not yet uploaded), CacheHitPercent (how many reads the cache answers) and CachePercentUsed. A dirty share that stays high means the link cannot keep up.

If the cache fills with dirty data, there is nothing left to evict, so the gateway slows down new writes until uploads catch up. Users see saves hang. The office link going down does not stop the share at once; a full cache of unuploaded data does.

Inside the S3 File Gateway cache

A garments company’s design team in Gazipur saves pattern files to an SMB share. The share is an S3 File Gateway with a 2 TiB cache. Follow what the cache does when things go well, and when they do not.

Scenario

Writes land in the cache first; only data already uploaded can be evicted.

Factory office
ap-southeast-1
Designer PCSMB
Active Directory
File Gateway2 TiB cachedirty 300 MB
S3 bucket
Cloud appwrites too
SMB write

Gateway metrics (CloudWatch)

Cache dirtyCache usedCache hitLink to AWS
2%61%94%up
Step 1 of 4
1

A designer saves a 300 MB pattern file. The gateway writes it to its local cache disk and confirms at once, so the save feels like a local NAS. The file is now dirty: it exists only on premises.

#Files, objects and metadata

The mapping from files to objects is simple, and its details matter for cost:

  • One file becomes one object. The file’s path becomes the object key (designs/2026/kurta-17.dxf). Folders become folder objects, as in the S3 console.
  • File metadata goes into object metadata: owner, group, permissions (POSIX for NFS, Windows ACLs for SMB) and timestamps, so the share looks the same after a cache refresh or on another gateway.
  • Partial changes upload efficiently, but a rename or a metadata change rewrites the object: S3 has no rename, so the gateway copies and deletes. Renaming a folder of 100,000 files means 100,000 copies.
  • With versioning on the bucket, every save and every metadata change creates a new version. Add a lifecycle rule that expires noncurrent versions, or the bill grows silently.
  • Maximum file size is 5 TiB, the largest S3 object.

#Storage classes and Glacier behind a share

A file share writes new objects into S3 Standard (the default), Standard-IA, One Zone-IA or Intelligent-Tiering. It cannot write straight into the Glacier classes, and it does not support Glacier Instant Retrieval at all. Three traps:

  • IA classes and edits. Standard-IA and One Zone-IA have a 30-day minimum. Because metadata changes recreate the object, writing directly to IA from a busy share can cause early-deletion charges. AWS recommends writing to Standard and letting a lifecycle rule move objects later.
  • Glacier through lifecycle. A lifecycle rule (lesson 10.5) can move objects to Glacier Flexible Retrieval or Deep Archive. Those files still appear in the share, but reading or updating one gives an I/O error until the object is restored in S3. Catch the error with an EventBridge rule and restore automatically if needed.
  • Intelligent-Tiering archive tiers. Do not turn on the optional Archive Access or Deep Archive Access tiers for a gateway bucket: files there make the share time out.

#Who may open what: security on a file share

  • AWS side. Each file share has an IAM role that lets the gateway read and write its bucket (or a prefix). Data is encrypted in transit with TLS and at rest with SSE-S3 by default, or SSE-KMS with your key (lesson 10.8).
  • NFS shares trust client IP ranges: only listed networks may mount, with root squash options as on any NFS server. NFS does not use AD.
  • SMB shares can use Active Directory (the gateway joins your domain; users log in with domain accounts and Windows ACLs apply), or guest access with one password for simple cases. SMB v3 can encrypt traffic on the office network too.
  • AD is a dependency. If the gateway cannot reach a domain controller, new SMB sessions fail even though the data is fine. Give it at least two domain controllers.
  • Audit logs of who opened, changed or deleted which file can go to CloudWatch Logs.

#When something else writes to the bucket

A gateway keeps its own cached view of each folder. If an application writes, changes or deletes objects directly in S3, the share does not show the change until the gateway refreshes its cache:

  • call RefreshCache (on demand, or from a schedule), or
  • turn on automated cache refresh with a time limit (for example 5 minutes): after that, the gateway re-reads a folder from S3 when it is accessed.

The opposite direction has a feature too: file upload notifications send an EventBridge event when a file written through the share has been fully uploaded to S3, so a cloud workflow (Lambda, Step Functions) can start processing only when the object is complete.

And one hard rule: there is no locking between gateways, or between a gateway and a direct S3 writer. Two offices can read the same bucket through two gateways, but if both edit the same file, the last upload silently wins. Give each office its own prefix for writing.

#S3 File Gateway or FSx for Windows File Server?

The notes give the deciding question:

The question saysAnswerWhy
S3 + NFS or SMB + on premisesS3 File GatewayLocal servers keep their protocol; data lands as S3 objects
Windows file sharing + AD, data should be a file system in AWS, no S3FSx for Windows File Server (lesson 12.2)A fully managed SMB file system with AD, DFS and Multi-AZ, used directly from EC2 and on premises
Linux shared file system in AWS for many EC2 instancesEFS (lesson 5.4)NFS natively, no gateway needed

#FSx File Gateway, briefly

Amazon FSx File Gateway put a local SMB cache in branch offices in front of an FSx for Windows File Server share, so users far from the Region got local speed. AWS stopped offering it to new customers on 28 October 2024; existing customers can keep using it. For new designs, users connect to FSx for Windows directly over Direct Connect or VPN, or use S3 File Gateway when the data belongs in S3. The exam may still list it; recognise the name.

Self-checkQuestion

A company’s on-premises Linux servers must read and write files with NFS, and the files must be stored as objects in an existing S3 bucket so that a data team can query them with Athena. Which service should the company use?

#Volume Gateway

#Block storage over iSCSI

Volume Gateway presents block storage volumes to your servers over iSCSI. A Windows server sees a new disk and formats it with NTFS; a Linux server formats it with ext4. A database can put its data files on it. The gateway stores the volume data in S3 (in storage the service manages, not your bucket) and backs it up as EBS snapshots, which can restore on-premises volumes or create EBS volumes for EC2.

It comes in two modes, and the difference is where the primary copy lives.

#Cached volumes: primary data in AWS

  • The full volume lives in S3. The gateway’s local disks hold a cache of recently used blocks and an upload buffer for writes on their way to AWS.
  • Writes go to the cache and upload buffer, are acknowledged, then uploaded. Reads of hot blocks are local; reads of cold blocks are fetched from S3 (slower).
  • Up to 32 TiB per volume, 32 volumes per gateway, 1,024 TiB in total.
  • Why pick it: a site with little local storage needs large volumes, and most of the data is rarely read. You buy disks only for the cache, not for the whole volume.

#Stored volumes: primary data on premises

  • The full volume stays on the gateway’s local disks, so every read and write is local: the lowest latency.
  • Changed blocks pass through an upload buffer and go to AWS asynchronously, as point-in-time snapshots (EBS snapshots, incremental), on a schedule or on demand.
  • Up to 16 TiB per volume, 32 volumes per gateway, 512 TiB in total.
  • Why pick it: the application needs local speed for everything and the company wants durable off-site backups. The trade-off: AWS holds only snapshots, so data written since the last snapshot exists only in the building.

Cached volumesStored volumes

  • Primary copy: S3
  • Local disks: cache + upload buffer only
  • Reads: hot blocks fast, cold blocks from S3
  • Volume size: up to 32 TiB
  • Good for: large volumes on a small site; data mostly cold
  • Exam phrase: “primary data in AWS, frequently used data cached on premises”
  • Primary copy: on premises
  • Local disks: the whole volume + upload buffer
  • Reads: always local
  • Volume size: up to 16 TiB
  • Good for: low latency for everything, off-site backup
  • Exam phrase: “keep all data on premises, asynchronous backup to AWS”

#Snapshots and recovery

Both modes create EBS snapshots of a volume, on a schedule (for example every night) or on demand, and AWS Backup can manage them. With a snapshot you can:

  • restore an on-premises volume: create a new gateway volume from the snapshot, on the same or a new gateway;
  • move to the cloud: create an EBS volume from the snapshot and attach it to an EC2 instance. This is how a Volume Gateway becomes disaster recovery: if the office is lost, the database runs on EC2 from last night’s snapshot. (A snapshot of a cached volume larger than 16 TiB can be restored only to a gateway volume, not to EBS.)
  • clone a cached volume from an existing one for testing.

Your recovery point is the snapshot schedule: with nightly snapshots, up to a day of writes can be lost if the building and the gateway are lost together (RPO and RTO are covered in chapter 23).

Volume Gateway: cached vs stored volumes

A database server mounts an iSCSI disk that is really a Volume Gateway volume. The gateway’s local disks act as cache and upload buffer; the volume data lives in S3 and is backed up as EBS snapshots.

Scenario

Primary data in S3; only recently used blocks are kept on premises.

Office data centre
ap-south-1
DB serveriSCSI initiator
Volume Gateway
Local diskscache + buffer
Volume dataS3
EBS snapshot
EC2 in AWS
iSCSI write

This volume

ModePrimary copyOn premisesIn AWS
cachedS3hot blocksall blocks
Step 1 of 4
1

The server writes blocks to its D: drive. To the server it is a plain disk over iSCSI; it formats it with NTFS and knows nothing about S3.

#When the upload buffer fills

The upload buffer (150 GiB to 2 TiB per gateway) is a staging area for data on its way to AWS. If a stored volume’s buffer fills, because writes are heavy and the link is slow, the volume goes into pass-through: the server keeps working, but the gateway stops tracking what still needs uploading. When space returns, the gateway must bootstrap, reading the whole volume to find the changes, and snapshots are not current until it finishes. Size the buffer for your busiest day and alarm on UploadBufferPercentUsed. On a cached volume, a full buffer slows down writes instead.

#Tape Gateway

#Why companies still use tapes

The notes explain tape from the beginning. Remember audio cassettes and the video cassettes of old, where songs and films were recorded on a magnetic strip? Big companies and banks back up their huge data, such as ten years of transaction records, on very modern and very large versions of the same thing: LTO tape cartridges. Why tapes?

  • Very cheap: tape costs far less per terabyte than hard disks or SSDs.
  • Long-term: hard disks fail, but data written on a magnetic tape easily lasts 10 to 30 years.
  • Security (air-gapped): written tapes are taken offline to a secure vault or another city, for example to a company like Iron Mountain. Hackers and ransomware cannot reach a tape sitting on a shelf.

The problem is handling. When tapes fill up, people must load new ones; trucks carry tapes from place to place; vaults and warehouses cost space and money; and a restore of an old backup takes days.

#What Tape Gateway is

Tape Gateway removes the physical handling and keeps the process. The notes describe it well:

  • It is software, a virtual appliance, that you install on your local servers (on VMware, Hyper-V or KVM, or on EC2).
  • It is a virtual tape library (VTL): on your network it pretends to be a physical tape drive and a robotic tape library.
  • It uses the iSCSI interface. Your company may already own expensive backup software (Veeam, Veritas NetBackup, Commvault and other leading products) that only knows how to work with tape machines over iSCSI. Tape Gateway connects to it the same way.
  • Keep the same software. Because the gateway introduces itself as a tape library, the backup software cannot tell whether it is writing to physical tapes or to the cloud. It keeps working as before; nothing new to buy or learn.
  • Virtually infinite storage. Instead of tape cartridges, the data goes over the network to AWS. You never run out of tapes.

#How the virtual tape library works

Each Tape Gateway comes with one media changer (the robot) and 10 tape drives, presented as iSCSI devices. You create virtual tapes with barcodes, each from 100 GiB to 15 TiB. One gateway holds up to 1,500 tapes or 1 PiB in its library at a time; the archive behind it has no limit.

Like the other gateways, it has local disks: a cache (150 GiB to 64 TiB) and an upload buffer (150 GiB to 2 TiB). The backup software writes to a virtual tape; the gateway stores the data in both, acknowledges, and uploads it asynchronously to the tape in S3.

#The life of a virtual tape

  1. Create a tape (console, API or automatically when the pool runs low). It appears in the library as Available.
  2. Write: the backup job loads it into a drive through the media changer and writes. The data is uploaded to S3, where the tapes of the library live.
  3. Eject (export) = archive. When the backup software ejects a tape, the gateway moves it to the archive (the virtual tape shelf), backed by S3 Glacier Flexible Retrieval or S3 Glacier Deep Archive, depending on the tape’s pool. The notes say backups go “directly to S3 Glacier”; precisely, they are stored in S3 first and archived on eject.
  4. Retrieve. An archived tape cannot be read directly. You retrieve it to a gateway: typically 3 to 5 hours from Glacier Flexible Retrieval, typically within 12 hours from Deep Archive. The retrieved tape is read-only.
  5. Delete when the retention period ends. Archived tapes have a minimum charge period (90 days in Glacier Flexible Retrieval, 180 days in Deep Archive), like the storage classes behind them.

#Protecting tapes from deletion

Air-gapped tapes protect against ransomware because nobody can reach them. Virtual tapes get two features for the same goal:

  • WORM tapes (write once, read many), set when the tape is created: data on an active tape cannot be overwritten or erased, only appended.
  • Tape Retention Lock on a custom tape pool: archived tapes cannot be deleted or moved for a fixed period, up to 100 years, in governance mode (users with special permission can remove the lock) or compliance mode (nobody can, not even the root user).

Tape Gateway: from the tape truck to Deep Archive

A Dhaka bank backs up its core banking database every night with its existing backup software. Compare physical tapes with Tape Gateway, then follow one virtual tape through its whole life.

Scenario

Cheap, long-lived and air-gapped, but slow and manual.

Bank data centre
ap-south-1
Backup serverbackup software
Tape libraryphysical
Off-site vault
write tape
Step 1 of 4
1

Every night the backup software writes the database to LTO cartridges in a robotic tape library over iSCSI or Fibre Channel. Tape is cheap per terabyte and lasts 10 to 30 years.

#Deploying and running a gateway

#Where the gateway runs

A gateway is software. You can run it:

  • On premises as a VM on VMware, Microsoft Hyper-V, Linux KVM or Nutanix. The minimum is 4 vCPUs, 16 GiB of RAM and an 80 GiB system disk, plus separate disks for the cache (and the upload buffer for volume and tape gateways). The link to AWS must be at least 100 Mbps to download, activate and update the gateway.
  • In AWS as an EC2 instance from the Storage Gateway AMI (an xlarge or larger x86 instance). Useful for disaster recovery (a gateway in the cloud that mounts the same data), for EC2 applications that need NFS or iSCSI over S3, and for testing. Do not put the cache on instance store: if the instance stops before uploads finish, that data is lost.
  • As a hardware appliance: a 1U server with the gateway preinstalled, for sites with no virtualisation. It is no longer sold since 12 May 2025; existing appliances are supported until May 2028. Lesson 10.11 and older courses still list it; for new designs use a VM or EC2.

#Activation and the network path

  1. Deploy the VM and attach its disks.
  2. Activate it: the console reaches the VM once on port 80 to get an activation key, choosing the Region and the endpoint type. Port 80 is needed only during activation.
  3. From then on the gateway connects outbound on HTTPS 443 to the Storage Gateway service and to S3. Nothing needs to come in from AWS.

The endpoint type decides the path:

EndpointPathWhen
PublicOver the internet, encrypted with TLSMost offices
VPC (PrivateLink)To an interface VPC endpoint, over Direct Connect or a Site-to-Site VPN (lessons 10.10, 22.4 and 22.5)Data must not cross the internet; File Gateways also need an S3 interface endpoint or access point
FIPSPublic, with FIPS-validated encryptionRegulated workloads in the United States

The gateway can also use dual-stack (IPv4 and IPv6) endpoints. On the office side, open only what clients need: NFS 2049 (plus 111 and 20048 for NFS v3), SMB 445, iSCSI 3260, and the AD ports for an SMB share.

#Bandwidth, maintenance and monitoring

  • Bandwidth rate limits and schedules: cap uploads (and downloads) at, for example, 50 Mbps from 9 a.m. to 6 p.m. and lift the cap at night. Writes still land in the cache at full speed; only uploads slow down, so the cache must hold a day of dirty data.
  • Maintenance window: AWS releases gateway software updates, which install in a weekly window you choose. A gateway restarts briefly during updates, so pick a quiet hour.
  • CloudWatch metrics and alarms: CachePercentDirty, CacheHitPercent, CachePercentUsed, UploadBufferPercentUsed, and the health of the gateway itself. Gateway logs and file share audit logs can go to CloudWatch Logs.

#High availability and failure

A gateway is one VM: if its host fails, every share, volume or tape drive on it stops answering. Two defences:

  • Run it on a VMware vSphere High Availability cluster with disks on shared storage. Storage Gateway integrates with VMware HA: if the host or the gateway fails, the VM restarts on another host within minutes, and the cache disk with its dirty data survives.
  • Protect the cache disk like any production disk. Dirty data exists nowhere else; if the cache disk is lost, the unuploaded data is lost too. For a lost gateway VM, you activate a new gateway and recover the data from AWS (for volumes, from the latest snapshot or recovery point); cloning a gateway VM from a snapshot is not supported.

Deploying a gateway: activation, private paths and failures

A gateway is a VM on your own hypervisor (or an EC2 instance). It talks to the Storage Gateway service and to S3 over HTTPS, on the internet or privately through a VPC endpoint.

Scenario

Download the image, give it disks, activate it in a Region.

Head office
ap-south-1
Admin PC
Staff PCs
Gateway VMon VMware4 vCPU, 16 GiB
Storage Gatewayservice
S3
Step 1 of 4
1

The admin downloads the gateway image for VMware (or Hyper-V, KVM, Nutanix, or an AMI for EC2) and gives the VM at least 4 vCPUs, 16 GiB of RAM, an 80 GiB system disk and a separate cache disk of 150 GiB or more.

The two questions every gateway design must answer. Try your own office’s numbers:

Gateway cache and link calculator

How big must the cache be, and can the link keep up? Pick the office’s numbers and press Calculate. Writes are assumed to happen during a 10-hour working day.

Data written per day

Office link to AWS

Share the gateway may use

Hot working set (files read often)

Link outage to survive

Choose the numbers, then press Calculate.

#Pricing

You pay for:

  • Data written to AWS by the gateway: about $0.01 per GB, capped at $125 per gateway per month; the first 100 GB per account are free.
  • Storage in AWS: S3 objects at normal S3 prices for a File Gateway; volume storage and EBS snapshot storage for a Volume Gateway; virtual tapes in S3, and archived tapes at Glacier Flexible Retrieval or Deep Archive prices (about $1 per TB per month), for a Tape Gateway.
  • Requests and retrievals: S3 requests, tape retrievals from the archive, and early deletion for archived tapes.
  • Data transfer out of AWS when data is read back to the office, at normal internet or Direct Connect rates; data to a gateway on EC2 in the same Region is free.
  • The host: your own hardware for a VM, or the EC2 instance and its EBS volumes.

#Storage Gateway and the alternatives

The notes compare it with DataSync, and the difference is the most useful sentence in this chapter: Storage Gateway is a continuous storage extension (it becomes part of your local storage and stays in the data path), while DataSync is a tool that copies or permanently migrates data from one place to another and then steps away. They are often used together: DataSync for the first bulk copy of years of files, then a File Gateway for the applications that keep writing.

NeedAnswer
Local apps keep using NFS / SMB, data in S3, foreverS3 File Gateway
Local block volumes with AWS backups or cloud-primary dataVolume Gateway (stored / cached)
Existing tape backup software, no physical tapesTape Gateway
Managed Windows file system in AWSFSx for Windows File Server (lesson 12.2)
One-time or scheduled copy, migration with a cut-over dateDataSync (lesson 12.4)
Tens of terabytes or more, and the network would take weeksSnowball Edge (lesson 12.1), then a gateway for new data
Partners send files over SFTP, FTPS, FTP or AS2Transfer Family (lesson 12.4)

Test yourself on real scenarios:

Which hybrid storage answer fits?

Pick a scenario, make your guess, then read why. Watch the keywords: NFS or SMB to S3, all data local, primary data in AWS, existing tape software, Windows with no S3, one-time migration.

1. Choose a scenario(Right first time: 0/8)

A Chattogram hospital’s imaging system can only write to an NFS share. The data must end up as objects in S3 so that an analytics team can query it and old scans can move to Glacier.

2. Your answer

#What goes wrong

SymptomLikely causeFix
Saves on the share hang, CachePercentDirty near 100%The link cannot keep up, or it is down, and the cache is full of unuploaded dataRestore the link, raise the bandwidth limit, add cache disks; size the cache for outages
Recent files open fast, older ones are slow or time outCache misses; the cache is too small for the working set, or the link is slowAdd cache; watch CacheHitPercent
Files written to the bucket by another app do not appear on the shareThe gateway’s cached listing is staleRefreshCache, a schedule, or automated cache refresh
A file edited in two offices loses one person’s changesTwo gateways (or a gateway and an app) wrote the same object; no lockingOne writer per prefix; others read only
I/O error when opening an old fileIts object was moved to Glacier Flexible Retrieval or Deep Archive by lifecycle (or to an Intelligent-Tiering archive tier)Restore the object; choose transition ages that match real reading
Unexpected early-deletion charges on an IA shareMetadata changes and edits recreate objects within 30 daysWrite to Standard, let lifecycle move objects to IA
Bill grows although data does notVersioning keeps every rewrite as a noncurrent versionLifecycle rule to expire noncurrent versions
Windows users suddenly cannot open the SMB shareThe gateway cannot reach Active Directory (domain controller down, DNS, ports, expired machine account)Two reachable domain controllers; check domain status and DNS
A stored volume shows pass-through or bootstrappingThe upload buffer filled upAdd upload buffer, check the link and the bandwidth schedule
Backup software cannot find an old tapeThe tape is archived; archived tapes are not in the libraryRetrieve it (3–5 h Flexible Retrieval, up to 12 h Deep Archive), then restore
Restore from a retrieved tape works, but the job cannot append to itRetrieved tapes are read-onlyWrite new backups to new tapes
A cached volume’s snapshot cannot be made into an EBS volumeThe volume is larger than 16 TiBRestore to a gateway volume instead, or keep volumes at 16 TiB or less
Every share and volume went offline at onceThe single gateway VM or its host failedVMware HA, monitoring, and a documented recovery to a new gateway
Data lost after stopping an EC2-hosted gatewayCache on instance store, stopped before uploads finishedUse EBS for the cache; wait for CachePercentDirty = 0 before stopping
Activation failsPort 80 from the browser or console to the VM blocked, or no outbound 443Open port 80 briefly for activation; allow the service endpoints

#Storage Gateway in system design

  • Cloud-backed file shares for offices and factories: S3 File Gateway in each site, one bucket behind them, each site writing its own prefix, lifecycle rules for archive. The files are available to analytics, ML and other AWS services as soon as they upload (file upload notifications can start a pipeline).
  • Tiered storage for a hospital or a newsroom: hot data in the cache, all data in S3, cold data in Glacier, and the application never changes.
  • Backup and disaster recovery: stored volumes or Tape Gateway for off-site copies; EBS snapshots restored to EC2 when the site is lost (backup and DR services, chapter 23).
  • Retire the tape library: Tape Gateway with Deep Archive pools and Tape Retention Lock for long regulatory retention.
  • Migration with a bridge: DataSync or Snowball for the bulk, a gateway while applications are still on premises, then a move to native AWS storage (S3, EFS, FSx) when they migrate.
  • Private and controlled: VPC endpoints over Direct Connect when data must not cross the internet; SSE-KMS keys you control; IAM roles per share.

#Try it yourself

These commands use example ARNs and names. Run them against a test gateway (a VM or an EC2 instance from the Storage Gateway AMI) that you have already deployed.

# 1. Activate a gateway as an S3 File Gateway, after getting the key from port 80
aws storagegateway activate-gateway --activation-key ABCD1-EFGH2-IJKL3-MNOP4-QRST5 \
  --gateway-name gazipur-design --gateway-timezone GMT+6:00 \
  --gateway-region ap-southeast-1 --gateway-type FILE_S3
#   "GatewayARN": "arn:aws:storagegateway:ap-southeast-1:111122223333:gateway/sgw-12A3456B"

# 2. Find the local disks and make one of them the cache
aws storagegateway list-local-disks --gateway-arn arn:aws:storagegateway:ap-southeast-1:111122223333:gateway/sgw-12A3456B
#   "Disks": [{ "DiskId": "pci-0000:03:00.0-scsi-0:0:1:0", "DiskSizeInBytes": 2199023255552,
#               "DiskAllocationType": "AVAILABLE" }]
aws storagegateway add-cache --gateway-arn <gateway-arn> \
  --disk-ids pci-0000:03:00.0-scsi-0:0:1:0

# 3. Join Active Directory, then create an SMB share that uses it, with automated cache refresh
#    every 300 seconds and a notification when each file has finished uploading
aws storagegateway join-domain --gateway-arn <gateway-arn> --domain-name corp.example.com \
  --user-name svc-sgw --password '<password>' --domain-controllers 10.20.0.10 10.20.0.11
aws storagegateway create-smb-file-share --client-token design-share-1 \
  --gateway-arn <gateway-arn> \
  --role arn:aws:iam::111122223333:role/FileGatewayS3Access \
  --location-arn arn:aws:s3:::garments-designs-example \
  --authentication ActiveDirectory --valid-user-list @Design \
  --default-storage-class S3_STANDARD \
  --cache-attributes CacheStaleTimeoutInSeconds=300 \
  --notification-policy '{"Upload":{"SettlingTimeInSeconds":60}}'
#   "FileShareARN": "arn:aws:storagegateway:ap-southeast-1:111122223333:share/share-5F7D8E9A"

# 4. After an app writes straight into the bucket, refresh one folder now
aws storagegateway refresh-cache --file-share-arn <share-arn> --folder-list /2026/ --recursive

# 5. Volume Gateway: a 20 TiB cached volume and a nightly snapshot schedule
aws storagegateway create-cached-iscsi-volume --gateway-arn <volume-gateway-arn> \
  --volume-size-in-bytes 21990232555520 --target-name newsroom-archive \
  --network-interface-id 10.30.1.15 --client-token vol-1
#   "TargetARN": "...:gateway/sgw-23B4567C/target/iqn.1997-05.com.amazon:newsroom-archive"
aws storagegateway update-snapshot-schedule --volume-arn <volume-arn> \
  --start-at 1 --recurrence-in-hours 24 --description "nightly"

# 6. Tape Gateway: create ten 2 TiB tapes in a Deep Archive pool, then list the archive
aws storagegateway create-tapes --gateway-arn <tape-gateway-arn> \
  --tape-size-in-bytes 2199023255552 --client-token tapes-1 --num-tapes-to-create 10 \
  --tape-barcode-prefix BNK --pool-id DEEP_ARCHIVE
aws storagegateway describe-tape-archives
#   "TapeArchives": [{ "TapeBarcode": "BNK00042", "TapeStatus": "ARCHIVED",
#                      "PoolId": "DEEP_ARCHIVE", "TapeSizeInBytes": 2199023255552 }]

# 7. Bring an archived tape back to the gateway (read-only), hours not days
aws storagegateway retrieve-tape-archive --tape-arn <tape-arn> --gateway-arn <tape-gateway-arn>

# 8. Limit uploads to 50 Mbps during office hours, Sunday to Thursday
aws storagegateway update-bandwidth-rate-limit-schedule --gateway-arn <gateway-arn> \
  --bandwidth-rate-limit-intervals \
  'StartHourOfDay=9,StartMinuteOfHour=0,EndHourOfDay=17,EndMinuteOfHour=59,DaysOfWeek=[0,1,2,3,4],AverageUploadRateLimitInBitsPerSec=50000000'

# 9. Watch the cache: how much is not uploaded yet?
aws cloudwatch get-metric-statistics --namespace AWS/StorageGateway \
  --metric-name CachePercentDirty --dimensions Name=GatewayId,Value=sgw-12A3456B Name=GatewayName,Value=gazipur-design \
  --start-time 2026-10-26T00:00:00Z --end-time 2026-10-26T12:00:00Z --period 3600 --statistics Maximum

On a Windows PC in the domain, the share is then simply \\10.20.1.15\garments-designs-example. On a Linux server, an iSCSI volume is discovered and mounted with the standard initiator:

sudo iscsiadm --mode discovery --type sendtargets --portal 10.30.1.15:3260
sudo iscsiadm --mode node --targetname iqn.1997-05.com.amazon:newsroom-archive \
  --portal 10.30.1.15:3260,1 --login
lsblk          # a new 20 TiB disk, for example /dev/sdb, ready to format

#Summary

Key takeaways

  • Hybrid storage exists because of long migrations, security, compliance and IT strategy. On the storage map, block = EBS, instance store; file = EFS, FSx; object = S3, Glacier. EFS speaks NFS; S3 has its own API, so on-premises servers need Storage Gateway to use it.
  • NFS = Linux file sharing, SMB = Windows file sharing, AD = central users and permissions, iSCSI = SCSI disk and tape commands over IP.
  • Four gateway types: S3 File Gateway (NFS/SMB → one object per file in your bucket), FSx File Gateway (closed to new customers since October 2024), Volume Gateway (iSCSI, data in S3, EBS snapshots in both modes), Tape Gateway (iSCSI VTL, tapes in S3, archived to Glacier Flexible Retrieval or Deep Archive on eject).
  • A File Gateway cache is write-back and read-through; it evicts only clean data, so it must hold the hot set plus all dirty data. Watch CachePercentDirty. Refresh the cache when others write to the bucket; there is no locking between writers.
  • File shares write to Standard, IA, One Zone-IA or Intelligent-Tiering, never straight to Glacier; lifecycle moves objects later, and archived files must be restored before reading. Glacier Instant Retrieval is not supported.
  • Cached volumes: primary data in S3, hot blocks local, up to 32 TiB. Stored volumes: all data local, asynchronous snapshots, up to 16 TiB. Snapshots restore on premises or become EBS volumes for EC2 (up to 16 TiB).
  • Tape Gateway: 10 drives + media changer, tapes 100 GiB–15 TiB, 1,500 tapes / 1 PiB per gateway, unlimited archive. Retrieval 3–5 h (Flexible) or within 12 h (Deep Archive), read-only. WORM tapes and Tape Retention Lock protect them. Keywords: existing backup software, VTL/iSCSI, eliminate physical tapes.
  • Deploy as a VM (VMware, Hyper-V, KVM, Nutanix) or EC2; the hardware appliance is no longer sold since May 2025. Activate on port 80, then outbound 443; public, VPC endpoint or FIPS. One gateway is one VM: plan HA and protect the cache disk.
  • Price: about $0.01 per GB written, capped at $125 per gateway per month, plus storage. Gateway = continuous extension; DataSync = copy or migrate and step away. Windows + AD with no S3 → FSx for Windows.