简体   繁体   English

如何在 C# SDK 中执行 Amazon S3 bucket copy

[英]How to perform Amazon S3 bucket copy in C# SDK

I need to copy the [EDIT: entire] contents of a bucket into another bucket.我需要将一个桶的 [EDIT: entire] 内容复制到另一个桶中。 The answers to this question implies that it can be done on the CLI, [EDIT: as a single operation (rather than looping over every record in the bucket)]这个问题的答案意味着它可以在 CLI 上完成,[编辑:作为单个操作(而不是遍历存储桶中的每条记录)]

Can it be done via any C# SDKs?可以通过任何 C# SDK 完成吗? We're currently using the AWSSDK.S3 Nuget package SDK, but I can't see any methods in that package's AmazonClient that would allow this sort of copy?我们目前正在使用AWSSDK.S3 Nuget package SDK,但我在该包的 AmazonClient 中看不到任何允许这种复制的方法?

The AWS SDK for .NET supports copying objects from one bucket to another. .NET 的AWS SDK支持将对象从一个存储桶复制到另一个存储桶。 However, you cannot copy ALL objects in a single call.但是,您不能在一次调用中复制所有对象。 See REF docs here:请在此处查看 REF 文档:

https://docs.aws.amazon.com/sdkfo.net/v3/apidocs/index.html?page=TS3Client.html&tocid=Amazon_S3_AmazonS3Client https://docs.aws.amazon.com/sdkfo.net/v3/apidocs/index.html?page=TS3Client.html&tocid=Amazon_S3_AmazonS3Client

The business logic to copy an object from one bucket to another can be found in the AWS Code Library , which contains hundreds of tested examples in supported programming languages.可以在AWS 代码库中找到将 object 从一个存储桶复制到另一个存储桶的业务逻辑,其中包含数百个以受支持的编程语言编写的经过测试的示例。

For this use case, see:对于此用例,请参阅:

在此处输入图像描述

URL - https://docs.aws.amazon.com/code-library/latest/ug/s3_example_s3_CopyObject_section.html URL - https://docs.aws.amazon.com/code-library/latest/ug/s3_example_s3_CopyObject_section.html

The code lib should be the first place to reference when you want to learn how to use the AWS SDK.当您想了解如何使用 AWS SDK 时,代码库应该是第一个参考的地方。

S3 Batch Operations, AWS Datasync, or S3 Replication could be options as well. S3 Batch Operations、AWS Datasync 或 S3 Replication 也可以作为选项。 These tools require more initial setup, but the actual data transfer will happen in a single request.这些工具需要更多的初始设置,但实际的数据传输将在单个请求中发生。 If there are a lot of objects to copy or this process is run frequently, it may be easier to automate using one of these options.如果有很多对象要复制或此过程经常运行,使用这些选项之一可能更容易实现自动化。

See https://aws.amazon.com/blogs/storage/considering-four-different-replication-options-for-data-in-amazon-s3/ for a comparison of a few options.有关几个选项的比较,请参阅https://aws.amazon.com/blogs/storage/considering-four-different-replication-options-for-data-in-amazon-s3/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么 amazon s3 cli 复制比 java sdk 在同一个桶中复制快得多? - Why amazon s3 cli copy much faster than java sdk in the same bucket? 如何将所有对象从一个 Amazon S3 存储桶复制到另一个存储桶? - How can I copy all objects from one Amazon S3 bucket to another bucket? 如何将Amazon AWS S3 Bucket中的数据复制到Apache Airflow MariaDB SQL表中 - How to copy data from Amazon AWS S3 Bucket into a MariaDB SQL table in Apache Airflow Amazon s3 只为一个桶返回 1000 个条目,而为另一个桶返回所有条目(使用 java sdk)? - Amazon s3 returns only 1000 entries for one bucket and all for another bucket (using java sdk)? 亚马逊 s3 将桶与桶策略 - Amazon s3 put bucket with bucket policy 如何更改 Amazon S3 存储桶中的文件路径名称? - How to change filepath names in Amazon S3 bucket? 如何使用 React js 将图像上传到 Amazon S3 存储桶? - How to upload image to an Amazon S3 bucket using React js? 如何使用 cURL 从 Amazon S3 存储桶中删除文件 - How to delete a file from amazon S3 bucket using cURL 在 C# 中使用 SFTP 将 MemoryStream 从 Amazon S3 存储桶发送到远程服务器时获取“无效路径” - Getting "Invalid path" when sending MemoryStream from Amazon S3 bucket to a remote server using SFTP in C# 如何在 C# SDK 中获取 AWS S3 DeleteMarkers? - How to fetch AWS S3 DeleteMarkers in C# SDK?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM