创建 S3 存储桶
Amazon 的 ARN(Amazon Resource Name,Amazon 资源名称)在存储桶场景下有固定格式。请练习为不同的 S3 存储桶生成 ARN。
S3 客户端已创建并保存在变量 s3 中。
本练习是课程的一部分
使用 AWS Kinesis 与 Lambda 处理流数据
练习说明
- 创建名为
"sd-vehicle-data"的新存储桶。 - 列出 S3 中可用的存储桶。
- 为每个存储桶生成 ARN 并打印。请记住,S3 的 ARN 格式为
"arn:aws:s3:::BUCKET_NAME"。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Create the new sd-vehicle-data bucket
s3.____(Bucket='sd-vehicle-data')
# List the buckets in S3
for bucket_info in s3.____()['Buckets']:
# Get the bucket_name
bucket_name = bucket_info['Name']
# Generate bucket ARN.
arn = "____:____:____:::{}".format(bucket_name)
# Print the ARN
print(arn)