本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
GetDistribution
搭配 使用 CLI
下列程式碼範例示範如何使用 GetDistribution
。
- CLI
-
- AWS CLI
-
若要取得 CloudFront 分佈
下列範例會使用 ID 取得 CloudFront 分佈
EDFDVBD6EXAMPLE
,包括其ETag
。分佈 ID 會在 create-distribution 和 list-distributions 命令中傳回。aws cloudfront get-distribution --id
EDFDVBD6EXAMPLE
輸出:
{ "ETag": "E2QWRUHEXAMPLE", "Distribution": { "Id": "EDFDVBD6EXAMPLE", "ARN": "arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE", "Status": "Deployed", "LastModifiedTime": "2019-12-04T23:35:41.433Z", "InProgressInvalidationBatches": 0, "DomainName": "d111111abcdef8.cloudfront.net", "ActiveTrustedSigners": { "Enabled": false, "Quantity": 0 }, "DistributionConfig": { "CallerReference": "cli-example", "Aliases": { "Quantity": 0 }, "DefaultRootObject": "index.html", "Origins": { "Quantity": 1, "Items": [ { "Id": "awsexamplebucket---s3.amazonaws.com.rproxy.goskope.com-cli-example", "DomainName": "awsexamplebucket.s3.amazonaws.com", "OriginPath": "", "CustomHeaders": { "Quantity": 0 }, "S3OriginConfig": { "OriginAccessIdentity": "" } } ] }, "OriginGroups": { "Quantity": 0 }, "DefaultCacheBehavior": { "TargetOriginId": "awsexamplebucket---s3.amazonaws.com.rproxy.goskope.com-cli-example", "ForwardedValues": { "QueryString": false, "Cookies": { "Forward": "none" }, "Headers": { "Quantity": 0 }, "QueryStringCacheKeys": { "Quantity": 0 } }, "TrustedSigners": { "Enabled": false, "Quantity": 0 }, "ViewerProtocolPolicy": "allow-all", "MinTTL": 0, "AllowedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ], "CachedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ] } }, "SmoothStreaming": false, "DefaultTTL": 86400, "MaxTTL": 31536000, "Compress": false, "LambdaFunctionAssociations": { "Quantity": 0 }, "FieldLevelEncryptionId": "" }, "CacheBehaviors": { "Quantity": 0 }, "CustomErrorResponses": { "Quantity": 0 }, "Comment": "", "Logging": { "Enabled": false, "IncludeCookies": false, "Bucket": "", "Prefix": "" }, "PriceClass": "PriceClass_All", "Enabled": true, "ViewerCertificate": { "CloudFrontDefaultCertificate": true, "MinimumProtocolVersion": "TLSv1", "CertificateSource": "cloudfront" }, "Restrictions": { "GeoRestriction": { "RestrictionType": "none", "Quantity": 0 } }, "WebACLId": "", "HttpVersion": "http2", "IsIPV6Enabled": true } } }
-
如需API詳細資訊,請參閱 命令參考 GetDistribution
中的 。 AWS CLI
-
- PowerShell
-
- 適用於 的工具 PowerShell
-
範例 1:擷取特定分佈的資訊。
Get-CFDistribution -Id EXAMPLE0000ID
-
如需API詳細資訊,請參閱 AWS Tools for PowerShell Cmdlet 參考 GetDistribution中的 。
-
如需開發人員指南和程式碼範例的完整清單 AWS SDK,請參閱 搭 CloudFront 配 AWS SDK 使用。本主題也包含有關入門的資訊,以及先前SDK版本的詳細資訊。
GetCloudFrontOriginAccessIdentityConfig
GetDistributionConfig