Skip to content

Instantly share code, notes, and snippets.

@sanampatel
Created October 13, 2019 19:04
Show Gist options
  • Select an option

  • Save sanampatel/6bf4f330503b4dcc2c0550164f29acd4 to your computer and use it in GitHub Desktop.

Select an option

Save sanampatel/6bf4f330503b4dcc2c0550164f29acd4 to your computer and use it in GitHub Desktop.
Print all S3 Buckets name from AWS Lambda Function
import json
import boto3
print('Loading function')
s3 = boto3.resource('s3')
def lambda_handler(event, context):
for bucket in s3.buckets.all():
print(bucket.name)
# print("Received event: " + json.dumps(event, indent=2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment