

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

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

# 将 `GetCloudFrontOriginAccessIdentityConfig` 与 CLI 配合使用
<a name="cloudfront_example_cloudfront_GetCloudFrontOriginAccessIdentityConfig_section"></a>

以下代码示例演示如何使用 `GetCloudFrontOriginAccessIdentityConfig`。

------
#### [ CLI ]

**AWS CLI**  
**获取 CloudFront 源站访问身份配置**  
以下示例获取有关带有 ID 的 CloudFront 源访问身份 (OAI) 的元数据`E74FTE3AEXAMPLE`，包括其`ETag`。OAI ID 将在-access-identity 和 create-cloud-front-origin-access-identitions 命令的输出中返回。list-cloud-front-origin  

```
aws cloudfront get-cloud-front-origin-access-identity-config --id E74FTE3AEXAMPLE
```
输出：  

```
{
    "ETag": "E2QWRUHEXAMPLE",
    "CloudFrontOriginAccessIdentityConfig": {
        "CallerReference": "cli-example",
        "Comment": "Example OAI"
    }
}
```
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[GetCloudFrontOriginAccessIdentityConfig](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloudfront/get-cloud-front-origin-access-identity-config.html)*中的。

------
#### [ PowerShell ]

**适用于 PowerShell V4 的工具**  
**示例 1：此示例返回有关单个 Amazon CloudFront 源访问身份的配置信息，该身份由-Id 参数指定。如果未指定 -Id 参数，则会出现错误。**  

```
Get-CFCloudFrontOriginAccessIdentityConfig -Id E3XXXXXXXXXXRT
```
**输出**：  

```
      CallerReference                                             Comment
      ---------------                                             -------
      mycallerreference: 2/1/2011 1:16:32 PM                      Caller reference: 2/1/2011 1:16:32 PM
```
+  有关 API 的详细信息，请参阅 *AWS Tools for PowerShell Cmdlet 参考 (V* 4) [GetCloudFrontOriginAccessIdentityConfig](https://docs.aws.amazon.com/powershell/v4/reference)中的。

**适用于 PowerShell V5 的工具**  
**示例 1：此示例返回有关单个 Amazon CloudFront 源访问身份的配置信息，该身份由-Id 参数指定。如果未指定 -Id 参数，则会出现错误。**  

```
Get-CFCloudFrontOriginAccessIdentityConfig -Id E3XXXXXXXXXXRT
```
**输出**：  

```
      CallerReference                                             Comment
      ---------------                                             -------
      mycallerreference: 2/1/2011 1:16:32 PM                      Caller reference: 2/1/2011 1:16:32 PM
```
+  有关 API 的详细信息，请参阅 *AWS Tools for PowerShell Cmdlet 参考 (V* 5) [GetCloudFrontOriginAccessIdentityConfig](https://docs.aws.amazon.com/powershell/v5/reference)中的。

------