从 python (lambda) 中的 s3 事件数据中提取 aws 区域
Extracting aws region from s3 event data in python (lambda)
我试图从 s3 事件数据中提取 aws 区域参数,我已经提取了存储桶名称和密钥,但我无法获取 aws 区域或打印整个事件数据
source_bucket = event['Records'][0]['s3']['bucket']['name']
key_created = urllib.unquote_plus(event['Records'][0]['s3']['object']['key']).decode('utf8')
您有可用的 S3 事件的 json 结构 here。
像下面这样的东西应该可以解决问题(未经测试)
event['Records'][0]['awsRegion']
我试图从 s3 事件数据中提取 aws 区域参数,我已经提取了存储桶名称和密钥,但我无法获取 aws 区域或打印整个事件数据
source_bucket = event['Records'][0]['s3']['bucket']['name']
key_created = urllib.unquote_plus(event['Records'][0]['s3']['object']['key']).decode('utf8')
您有可用的 S3 事件的 json 结构 here。
像下面这样的东西应该可以解决问题(未经测试)
event['Records'][0]['awsRegion']