[英]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.