Skip to content

Instantly share code, notes, and snippets.

@heyseus1
Last active March 4, 2021 21:54
Show Gist options
  • Save heyseus1/b2e5de28f2d678a62054e717b96e1477 to your computer and use it in GitHub Desktop.
Save heyseus1/b2e5de28f2d678a62054e717b96e1477 to your computer and use it in GitHub Desktop.
AWS Storage Gateway Refresh Cache Lambda script
#!/usr/bin/env python3
import boto3
def default_handler( event, context ):
print(boto3.client('sts').get_caller_identity())
''' replace share-id with actual Id(s)'''
client = boto3.client('storagegateway')
fileshare = ['share-ID', 'share-ID', 'share-ID', 'share-ID']
for path in fileshare:
response = client.refresh_cache(
FileShareARN = f"arn:aws:storagegateway:us-west-1:ARN-id-goes-here:share/{path}",
FolderList=['/'],
Recursive=True
)
print(response)
default_handler( None, None )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment