如何使用boto3将文件上传到Amazon Glacier Deep Archive [英] How to upload a file to Amazon Glacier Deep Archive using boto3

查看:58
本文介绍了如何使用boto3将文件上传到Amazon Glacier Deep Archive的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设法将文件上传到Glacier,但是我想直接上传到Deep Archive.我已经搜索了文档,但是没有提到如何将存储类直接设置为 DEEP_ARCHIVE .

I've managed to upload a file to Glacier, but I want to upload to Deep Archive directly. I've searched the documentation, but found no mentions of how to set the storage class to DEEP_ARCHIVE directly.

推荐答案

您可以使用具有 StorageClass 参数的 put_object(),也可以使用<指定 ExtraArgs 的同时,输入code> upload_file():

You can either use put_object(), which has a StorageClass parameter, or you can use upload_file() while specifying ExtraArgs:

import boto3

s3_client = boto3.client('s3')

s3_client.upload_file('/tmp/hello.txt', 'my-bucket', 'hello.txt', ExtraArgs={'StorageClass': 'DEEP_ARCHIVE'})

允许的 ExtraArgs 可在要澄清:这是上载到Amazon S3 ,但是将存储类设置为 Glacier Deep Archive .这与上传到Amazon Glacier服务不同.(如今,通过S3存储类更容易使用Glacier.)

To clarify: This is uploading to Amazon S3 but setting the Storage Class to Glacier Deep Archive. This is different to uploading to the Amazon Glacier service. (These days it is easier to use Glacier via S3 storage classes).

这篇关于如何使用boto3将文件上传到Amazon Glacier Deep Archive的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆