AWS Storage Gateway User Guide
Getting Notified About File Operations
The following example shows a rule that triggers the specified event type in the specified gateway and
in the specified AWS Region. For example, you could specify the
Storage Gateway File Upload
Event
as the event type.
{
"source":[
"aws.storagegateway"
],
"resources":[
"arn:aws:storagegateway:
AWS Region
:
account-id
:gateway/
gateway-id
"
],
"detail-type":[
"
Event type
"
]
}
For information about how to use CloudWatch Events to trigger rules, see
Rule That Triggers on an Event
in the
Amazon CloudWatch Events User Guide
.
Getting File Upload Notification
There are two use cases you could use the file upload notification for:
For automating in-cloud processing of files that are uploaded, you could call the
NotifyWhenUploaded
API and get back a notification id. The notification that is triggered when the files have been uploaded
have the same notification id as the one that was returned by the API. If you map this notification id to
track the list of files that you are uploading, you could trigger processing of the files that are uploaded in
AWS when the event with the same id is generated.
For content distribution use cases, you could have two file gateways that mapped to the same Amazon
S3 bucket. The file share client for Gateway1 could upload new files to S3 and the files are read by file
share clients on Gateway 2 . The files will upload to S3 but they will not be visible to Gateway2 because
it uses a locally cached version of files in S3. To make the files visible in gateway2, you can use the
API to request file upload notification from Gateway1 to notify you when the
upload is done. You can then use the CloudWatch Events to automatically issue
request
for the file share on Gateway2. When the
request completes the new files will be visible in
Gateway2.
Example Example—File Upload Notification
The following example shows a file upload notification that is sent to you through CloudWatch when
the event matches the rule you created. This notification is in JSON format. You can configure this
notification to be delivered to the target as a text message.
{
"version" : "2012-10-17",
"id" : "2649b160-d59d-c97f-3f64-8aaa9ea6aed3",
"detail-type" : "Storage Gateway Upload Notification Event",
"source" : "aws.storagegateway",
"account" : "123456789012",
"time" : "2017-11-06T21:34:42Z",
"region" : "us-east-2",
"resources" : [
"arn:aws:storagegateway:us-east-2:123456789011:share/share-F123D451",
"arn:aws:storagegateway:us-east-2:123456789011:gateway/sgw-712345DA"
],
"detail" : {
"event-type" :"upload-complete",
API Version 2013-06-30
200