Last active
March 4, 2021 21:54
-
-
Save heyseus1/b2e5de28f2d678a62054e717b96e1477 to your computer and use it in GitHub Desktop.
AWS Storage Gateway Refresh Cache Lambda script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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