

文档 AWS SDK 示例 GitHub 存储库中还有更多 [S AWS DK 示例](https://github.com/awsdocs/aws-doc-sdk-examples)。

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

# 使用的代码示 CloudFront 例 AWS SDKs
<a name="cloudfront_code_examples"></a>

以下代码示例向您展示了如何将 Amazon CloudFront 与 AWS 软件开发套件 (SDK) 配合使用。

*操作*是大型程序的代码摘录，必须在上下文中运行。您可以通过操作了解如何调用单个服务函数，还可以通过函数相关场景的上下文查看操作。

*场景*是向您展示如何通过在一个服务中调用多个函数或与其他 AWS 服务服务结合来完成特定任务的代码示例。

**更多资源**
+  **[ CloudFront 开发者指南](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Introduction.html)** —有关的更多信息 CloudFront.
+ **[CloudFront API 参考](https://docs.aws.amazon.com/cloudfront/latest/APIReference/Welcome.html)**-有关所有可用 CloudFront 操作的详细信息。
+ **[AWS 开发者中心](https://aws.amazon.com/developer/code-examples/?awsf.sdk-code-examples-product=product%23cloudfront)** — 您可以按类别或全文搜索筛选的代码示例。
+ **[AWS SDK 示例](https://github.com/awsdocs/aws-doc-sdk-examples)** — 包含首选语言完整代码的 GitHub 存储库。包括有关设置和运行代码的说明。

**Contents**
+ [基本功能](cloudfront_code_examples_basics.md)
  + [操作](cloudfront_code_examples_actions.md)
    + [`CreateDistribution`](cloudfront_example_cloudfront_CreateDistribution_section.md)
    + [`CreateFunction`](cloudfront_example_cloudfront_CreateFunction_section.md)
    + [`CreateInvalidation`](cloudfront_example_cloudfront_CreateInvalidation_section.md)
    + [`CreateKeyGroup`](cloudfront_example_cloudfront_CreateKeyGroup_section.md)
    + [`CreatePublicKey`](cloudfront_example_cloudfront_CreatePublicKey_section.md)
    + [`DeleteDistribution`](cloudfront_example_cloudfront_DeleteDistribution_section.md)
    + [`GetCloudFrontOriginAccessIdentity`](cloudfront_example_cloudfront_GetCloudFrontOriginAccessIdentity_section.md)
    + [`GetCloudFrontOriginAccessIdentityConfig`](cloudfront_example_cloudfront_GetCloudFrontOriginAccessIdentityConfig_section.md)
    + [`GetDistribution`](cloudfront_example_cloudfront_GetDistribution_section.md)
    + [`GetDistributionConfig`](cloudfront_example_cloudfront_GetDistributionConfig_section.md)
    + [`ListCloudFrontOriginAccessIdentities`](cloudfront_example_cloudfront_ListCloudFrontOriginAccessIdentities_section.md)
    + [`ListDistributions`](cloudfront_example_cloudfront_ListDistributions_section.md)
    + [`UpdateDistribution`](cloudfront_example_cloudfront_UpdateDistribution_section.md)
+ [场景](cloudfront_code_examples_scenarios.md)
  + [创建多租户分配和分配租户](cloudfront_example_cloudfront_CreateSaasResources_section.md)
  + [删除签名资源](cloudfront_example_cloudfront_DeleteSigningResources_section.md)
  + [开始使用基本 CloudFront 发行版](cloudfront_example_cloudfront_GettingStarted_section.md)
  + [WAF 入门](cloudfront_example_wafv2_GettingStarted_052_section.md)
  + [签名 URLs 和饼干](cloudfront_example_cloudfront_CloudFrontUtilities_section.md)
+ [CloudFront 函数示例](cloudfront_code_examples_cloudfront_functions_examples.md)
  + [添加 HTTP 安全标头](cloudfront_example_cloudfront_functions_add_security_headers_section.md)
  + [添加 CORS 标头](cloudfront_example_cloudfront_functions_add_cors_header_section.md)
  + [添加缓存控制标头](cloudfront_example_cloudfront_functions_add_cache_control_header_section.md)
  + [添加真实客户端 IP 标头](cloudfront_example_cloudfront_functions_add_true_client_ip_header_section.md)
  + [添加源标头](cloudfront_example_cloudfront_functions_add_origin_header_section.md)
  + [将 index.html 添加到请求中 URLs](cloudfront_example_cloudfront_functions_url_rewrite_single_page_apps_section.md)
  + [标准化查询字符串参数](cloudfront_example_cloudfront_functions_normalize_query_string_parameters_section.md)
  + [重定向到新 URL](cloudfront_example_cloudfront_functions_redirect_based_on_country_section.md)
  + [重写请求 URI](cloudfront_example_cloudfront_functions_kvs_conditional_read_section.md)
  + [选择离查看器更近的来源](cloudfront_example_cloudfront_functions_select_origin_based_on_country_section.md)
  + [使用键值对](cloudfront_example_cloudfront_functions_kvs_key_value_pairs_section.md)
  + [验证简单令牌](cloudfront_example_cloudfront_functions_kvs_jwt_verify_section.md)