

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 使用 Amazon S3 代码示例 适用于 C\+\+ 的 AWS SDK
<a name="examples-s3"></a>

[Amazon S3](https://aws.amazon.com/s3) 是专为从任意位置存储和检索任意数量的数据而构建的对象存储。提供了多个类来与 Amazon S3 接口。 适用于 C\+\+ 的 AWS SDK 

**注意**  
本指南中仅提供了演示某些技术所需的代码，但[完整的示例代码可在上找到 GitHub](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/cpp)。 GitHub 您可以下载单个源文件，也可以在本地克隆存储库以获取、构建和运行所有示例。
+ [https://docs.aws.amazon.com/sdk-for-cpp/latest/api/aws-cpp-sdk-s3/html/class_aws_1_1_s3_1_1_s3_client.html](https://docs.aws.amazon.com/sdk-for-cpp/latest/api/aws-cpp-sdk-s3/html/class_aws_1_1_s3_1_1_s3_client.html) 类 

  `S3Client` 库是一个功能齐全的 Amazon S3 接口。

  本集中的`list_buckets_disabling_dns_cache.cpp`示例专门针对在 CURL 开启的情况下使用 Linux/Mac （尽管可以修改为在 Windows 上运行）。如果你使用的是 Windows，请在生成项目`list_buckets_disabling_dns_cache.cpp`之前删除该文件，因为它依赖于 Linux 的 curl HttpClient 。

  使用 `S3Client` 的示例代码位于 Github 上的 [`s3` 文件夹](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/cpp/example_code/s3)中。有关此示例集演示的函数的完整列表，请参阅 Github 上的[自述文件](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/cpp/example_code/s3/README.md)。

  本指南更详细地介绍了 `s3` 示例集的各个部分：
  + [创建、列出和删除存储桶](examples-s3-buckets.md)
  + [在对象上的操作](examples-s3-objects.md) – 上传和下载数据对象
  + [管理 Amazon S3 访问权限](examples-s3-access-permissions.md)
  + [使用存储桶策略管理对 Amazon S3 存储桶的访问](examples-s3-bucket-policies.md)
  + [将 Amazon S3 存储桶配置为网站](examples-s3-website-configuration.md)
+ [https://docs.aws.amazon.com/sdk-for-cpp/latest/api/aws-cpp-sdk-s3-crt/html/class_aws_1_1_s3_crt_1_1_s3_crt_client.html](https://docs.aws.amazon.com/sdk-for-cpp/latest/api/aws-cpp-sdk-s3-crt/html/class_aws_1_1_s3_crt_1_1_s3_crt_client.html) 类 

  `S3CrtClient` 在 SDK 的 1.9 版本中被引入。`S3CrtClient` 为 Amazon S3 的 GET（下载）和 PUT（上传）操作提供高吞吐量。`S3CrtClient`是在 AWS 公共运行时 (CRT) 库的顶部实现的。

  使用 `S3CrtClient` 的示例代码位于 Github 上的 [`s3-crt` 文件夹](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/cpp/example_code/s3-crt)中。有关此示例集演示的函数的完整列表，请参阅 Github 上的[自述文件](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/cpp/example_code/s3-crt/README.md)。
  + [使用 `S3CrtClient` 执行 Amazon S3 操作](examples-s3-crt.md)
+ [https://docs.aws.amazon.com/sdk-for-cpp/latest/api/aws-cpp-sdk-transfer/html/class_aws_1_1_transfer_1_1_transfer_manager.html](https://docs.aws.amazon.com/sdk-for-cpp/latest/api/aws-cpp-sdk-transfer/html/class_aws_1_1_transfer_1_1_transfer_manager.html) 类 

  `TransferManager` 是一项完全托管式服务，支持通过文件传输协议（FTP）、基于 SSL 的文件传输协议（FTPS）或 Secure Shell（SSH）文件传输协议（SFTP），直接向 Amazon S3 中传入文件以及从中传出文件。

  使用 `TransferManager` 的示例代码位于 Github 上的 [`transfer-manager` 文件夹](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/cpp/example_code/transfer-manager)中。有关此示例集演示的函数的完整列表，请参阅 Github 上的[自述文件](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/cpp/example_code/transfer-manager/README.md)。
  + [用 TransferManager 于 Amazon S3 操作](examples-s3-transfermanager.md)