There are more AWS SDK examples available in the AWS Doc SDK Examples
Use GetCloudFrontOriginAccessIdentity with a CLI
The following code examples show how to use GetCloudFrontOriginAccessIdentity.
- CLI
-
- AWS CLI
-
To get a CloudFront origin access identity
The following
get-cloud-front-origin-access-identityexample gets the CloudFront origin access identity (OAI) with the IDE74FTE3AEXAMPLE, including itsETagand the associated S3 canonical ID. The OAI ID is returned in the output of the create-cloud-front-origin-access-identity and list-cloud-front-origin-access-identities commands.aws cloudfront get-cloud-front-origin-access-identity \ --idE74FTE3AEXAMPLEOutput:
{ "ETag": "E2QWRUHEXAMPLE", "CloudFrontOriginAccessIdentity": { "Id": "E74FTE3AEXAMPLE", "S3CanonicalUserId": "cd13868f797c227fbea2830611a26fe0a21ba1b826ab4bed9b7771c9aEXAMPLE", "CloudFrontOriginAccessIdentityConfig": { "CallerReference": "cli-example", "Comment": "Example OAI" } } }For more information, see Restrict access to an Amazon S3 origin in the Amazon CloudFront Developer Guide.
-
For API details, see GetCloudFrontOriginAccessIdentity
in AWS CLI Command Reference.
-
- PowerShell
-
- Tools for PowerShell V4
-
Example 1: This example returns a specific Amazon CloudFront origin access identity, specified by the -Id parameter. Although the -Id parameter is not required, if you do not specify it, no results are returned.
Get-CFCloudFrontOriginAccessIdentity -Id E3XXXXXXXXXXRTOutput:
CloudFrontOriginAccessIdentityConfig Id S3CanonicalUserId ------------------------------------ -- ----------------- Amazon.CloudFront.Model.CloudFrontOr... E3XXXXXXXXXXRT 4b6e...-
For API details, see GetCloudFrontOriginAccessIdentity in AWS Tools for PowerShell Cmdlet Reference (V4).
-
- Tools for PowerShell V5
-
Example 1: This example returns a specific Amazon CloudFront origin access identity, specified by the -Id parameter. Although the -Id parameter is not required, if you do not specify it, no results are returned.
Get-CFCloudFrontOriginAccessIdentity -Id E3XXXXXXXXXXRTOutput:
CloudFrontOriginAccessIdentityConfig Id S3CanonicalUserId ------------------------------------ -- ----------------- Amazon.CloudFront.Model.CloudFrontOr... E3XXXXXXXXXXRT 4b6e...-
For API details, see GetCloudFrontOriginAccessIdentity in AWS Tools for PowerShell Cmdlet Reference (V5).
-