user3323241
user3323241

Reputation: 479

Extracting aws region from s3 event data in python (lambda)

I trying to extract the aws region parameter from the s3 event data, I have already extracted the the bucket name and the key but I am unable to get the aws region or print the whole event data

source_bucket = event['Records'][0]['s3']['bucket']['name'] key_created = urllib.unquote_plus(event['Records'][0]['s3']['object']['key']).decode('utf8')

Upvotes: 0

Views: 1145

Answers (1)

Tom
Tom

Reputation: 2888

you have the json structure of an S3 event available here.

sth like below should do the trick (untested)

event['Records'][0]['awsRegion']

Upvotes: 1

Related Questions