Skip to main content
 首页 » 编程设计

python之如何通过 Boto3 检查现有 key 的存储类

2025年05月04日23JustinYoung

有没有办法使用 Python2.7 + Boto3 获取 AWS 服务(S3)中 key 的存储类?

我知道 Boto2 是这样的:

print key.storage_class 

但我找不到用 Boto3 获得的东西。

请您参考如下方法:

import boto3 
 
s3 = boto3.resource('s3') 
key = s3.Object('bucket_name','key') 
print key.storage_class