I have a Network File System (NFS) or Server Message Block (SMB) file share on my AWS Storage Gateway file gateway. The file gateway is associated with an Amazon Simple Storage Service (Amazon S3) bucket. However, when I upload files directly to the bucket, I can't see the files on my file share.
Resolution
When you use the file share to locally write files to the cache, Storage Gateway automatically updates the file share cache. However, Storage Gateway doesn't automatically update the cache when you upload a file directly to Amazon S3. When you upload a file directly to Amazon S3, you must perform a RefreshCache operation to see the changes on the file share.
Storage Gateway allows you to automate the RefreshCache operation based on a Time To Live (TTL) value. TTL is the length of time since the last refresh. When you access the file directory after the TTL value, the file gateway refreshes the directory's contents from the Amazon S3 bucket. Valid TTL values to automate the RefreshCache operation range from 300 seconds to 2,592,000 seconds.
Note: After your TTL value expires, the file gateway invokes the ListObjects Amazon S3 API call at the folder level. If you set TTL to a low value, then Amazon S3 API requests and associated costs might increase.
You can use either the Storage Gateway console to automate the RefreshCache operation or the UpdateNFSFileShare or UpdateSMBFileShare Storage Gateway APIs. For both API calls, you must update the CacheAttributes parameter and specify the TTL value in CacheStaleTimeoutInSeconds.
To use the console, complete the following steps:
- Open the Storage Gateway console.
- Choose File shares.
- Choose the file share that you want to automate the RefreshCache operation for.
- Choose Actions, and then choose Edit file share settings.
- Under Non-gateway file cache refresh time, select Set refresh interval.
- Set the time in days, hours, and minutes to refresh the file share's cache with TTL. Valid values range between 5 minutes and 30 days.
- Choose Save.
To run RefreshCache at only one point in time, you can manually refresh the cache.
The amount of time that the refresh process takes to complete depends on the following conditions:
- Number of objects that are cached on the gateway.
- Number of objects that you added to or removed from the bucket after the last refresh.
Note: When you refresh the cache, you initiate RefreshCache. However, file refresh is a separate process. You can set up refresh cache notifications to get updates on the file refresh process. When you receive refresh-complete notification, the file refresh process is complete.