

文件 AWS 開發套件範例 GitHub 儲存庫中有更多可用的 [AWS SDK 範例](https://github.com/awsdocs/aws-doc-sdk-examples)。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 搭配使用 `GetCloudFrontOriginAccessIdentityConfig` 與 CLI
<a name="cloudfront_example_cloudfront_GetCloudFrontOriginAccessIdentityConfig_section"></a>

下列程式碼範例示範如何使用 `GetCloudFrontOriginAccessIdentityConfig`。

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

**AWS CLI**  
**取得 CloudFront 原始存取身分組態**  
下列範例取得 ID 為 `E74FTE3AEXAMPLE` 的 CloudFront 原始存取身分 (OAI) 的中繼資料，包括其 `ETag`。OAI ID 會在 create-cloud-front-origin-access-identity 和 list-cloud-front-origin-access-identities 命令的輸出中傳回。  

```
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 ]

**Tools for PowerShell V4**  
**範例 1：此範例傳回 -Id 參數所指定之單一 Amazon CloudFront 原始存取身分的組態資訊。如果未指定 -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 參考 (V4)》**中的 [GetCloudFrontOriginAccessIdentityConfig](https://docs.aws.amazon.com/powershell/v4/reference)。

**Tools for PowerShell V5**  
**範例 1：此範例傳回 -Id 參數所指定之單一 Amazon CloudFront 原始存取身分的組態資訊。如果未指定 -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 參考 (V5)》**中的 [GetCloudFrontOriginAccessIdentityConfig](https://docs.aws.amazon.com/powershell/v5/reference)。

------