

# 使用 Amazon SDK 的 CloudFront 代码示例
<a name="service_code_examples"></a>

以下代码示例演示如何将 CloudFront 与 Amazon 软件开发工具包（SDK）结合使用。

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

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

有关 Amazon SDK 开发人员指南和代码示例的完整列表，请参阅[将 CloudFront 与 Amazon SDK 配合使用](sdk-general-information-section.md)。本主题还包括有关入门的信息以及有关先前的 SDK 版本的详细信息。

**Contents**
+ [基本功能](service_code_examples_basics.md)
  + [操作](service_code_examples_actions.md)
    + [`CreateDistribution`](example_cloudfront_CreateDistribution_section.md)
    + [`CreateFunction`](example_cloudfront_CreateFunction_section.md)
    + [`CreateInvalidation`](example_cloudfront_CreateInvalidation_section.md)
    + [`CreateKeyGroup`](example_cloudfront_CreateKeyGroup_section.md)
    + [`CreatePublicKey`](example_cloudfront_CreatePublicKey_section.md)
    + [`DeleteDistribution`](example_cloudfront_DeleteDistribution_section.md)
    + [`GetCloudFrontOriginAccessIdentity`](example_cloudfront_GetCloudFrontOriginAccessIdentity_section.md)
    + [`GetCloudFrontOriginAccessIdentityConfig`](example_cloudfront_GetCloudFrontOriginAccessIdentityConfig_section.md)
    + [`GetDistribution`](example_cloudfront_GetDistribution_section.md)
    + [`GetDistributionConfig`](example_cloudfront_GetDistributionConfig_section.md)
    + [`ListCloudFrontOriginAccessIdentities`](example_cloudfront_ListCloudFrontOriginAccessIdentities_section.md)
    + [`ListDistributions`](example_cloudfront_ListDistributions_section.md)
    + [`UpdateDistribution`](example_cloudfront_UpdateDistribution_section.md)
+ [场景](service_code_examples_scenarios.md)
  + [创建多租户分配和分配租户](example_cloudfront_CreateSaasResources_section.md)
  + [删除签名资源](example_cloudfront_DeleteSigningResources_section.md)
  + [CloudFront 入门](example_cloudfront_GettingStarted_section.md)
  + [对 URL 和 Cookie 进行签名](example_cloudfront_CloudFrontUtilities_section.md)
+ [CloudFront Functions 示例](service_code_examples_cloudfront_functions_examples.md)
  + [添加 HTTP 安全标头](example_cloudfront_functions_add_security_headers_section.md)
  + [添加 CORS 标头](example_cloudfront_functions_add_cors_header_section.md)
  + [添加缓存控制标头](example_cloudfront_functions_add_cache_control_header_section.md)
  + [添加真实客户端 IP 标头](example_cloudfront_functions_add_true_client_ip_header_section.md)
  + [添加源标头](example_cloudfront_functions_add_origin_header_section.md)
  + [将 index.html 添加到请求 URL](example_cloudfront_functions_url_rewrite_single_page_apps_section.md)
  + [标准化查询字符串参数](example_cloudfront_functions_normalize_query_string_parameters_section.md)
  + [重定向到新 URL](example_cloudfront_functions_redirect_based_on_country_section.md)
  + [重写请求 URI](example_cloudfront_functions_kvs_conditional_read_section.md)
  + [选择离查看器更近的来源](example_cloudfront_functions_select_origin_based_on_country_section.md)
  + [使用键值对](example_cloudfront_functions_kvs_key_value_pairs_section.md)
  + [验证简单令牌](example_cloudfront_functions_kvs_jwt_verify_section.md)