View a markdown version of this page

CloudFront Beispiele mit AWS CLI - AWS Command Line Interface

Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich.

CloudFront Beispiele mit AWS CLI

Die folgenden Codebeispiele zeigen Ihnen, wie Sie mithilfe von AWS Command Line Interface with Aktionen ausführen und allgemeine Szenarien implementieren CloudFront.

Aktionen sind Codeauszüge aus größeren Programmen und müssen im Kontext ausgeführt werden. Während Aktionen Ihnen zeigen, wie Sie einzelne Service-Funktionen aufrufen, können Sie Aktionen im Kontext der zugehörigen Szenarien anzeigen.

Jedes Beispiel enthält einen Link zum vollständigen Quellcode, wo Sie Anweisungen zum Einrichten und Ausführen des Codes im Kodex finden.

Themen

Aktionen

Das folgende Codebeispiel zeigt, wie man. associate-distribution-tenant-web-acl

AWS CLI

Um eine Web-ACL einem CloudFront Distributionsmandanten zuzuordnen

Das folgende associate-distribution-tenant-web-acl Beispiel verknüpft eine Web-ACL mit einer CloudFront Distribution mit ETagE13V1IB3VIYABC.

aws cloudfront associate-distribution-tenant-web-acl \ --id dt_2wjDZi3hD1ivOXf6rpZJO1AB \ --if-match E13V1IB3VIYABC \ --web-acl-arn arn:aws:wafv2:us-east-1:123456789012:global/webacl/web-global-example/626900da-5f64-418b-ba9b-743f37123ABC

Ausgabe:

{ "ETag": "E1VC38T7YXBABC", "Id": "dt_2wjDZi3hD1ivOXf6rpZJO1AB", "WebACLArn": "arn:aws:wafv2:us-east-1:123456789012:global/webacl/web-global-example/626900da-5f64-418b-ba9b-743f37123ABC" }

Weitere Informationen finden Sie unter Verwenden AWS von WAF-Schutzmaßnahmen im Amazon CloudFront Developer Guide.

Das folgende Codebeispiel zeigt, wie man. associate-distribution-web-acl

AWS CLI

Um eine Web-ACL einer CloudFront Distribution zuzuordnen

Im folgenden associate-distribution-web-acl Beispiel wird eine Web-ACL einer CloudFront Distribution zugeordnet.

aws cloudfront associate-distribution-web-acl \ --id E1XNX8R2GOAABC \ --if-match E2YWS1C2J3OABC \ --web-acl-arn arn:aws:wafv2:us-east-1:123456789012:global/webacl/web-global-example/626900da-5f64-418b-ba9b-743f3746cABC

Ausgabe:

{ "ETag": "E3QE7ED60U0ABC", "Id": "E1XNX8R2GOAABC", "WebACLArn": "arn:aws:wafv2:us-east-1:123456789012:global/webacl/web-global-example/626900da-5f64-418b-ba9b-743f3746cABC" }

Weitere Informationen finden Sie unter Verwenden AWS von WAF-Schutzmaßnahmen im Amazon CloudFront Developer Guide.

Das folgende Codebeispiel zeigt die Verwendung. create-cloud-front-origin-access-identity

AWS CLI

Um eine CloudFront ursprüngliche Zugriffsidentität zu erstellen

Im folgenden Beispiel wird eine CloudFront Origin-Zugriffsidentität (OAI) erstellt, indem die OAI-Konfiguration als Befehlszeilenargument bereitgestellt wird:

aws cloudfront create-cloud-front-origin-access-identity \ --cloud-front-origin-access-identity-config \ CallerReference="cli-example",Comment="Example OAI"

Sie können dasselbe erreichen, indem Sie die OAI-Konfiguration in einer JSON-Datei bereitstellen, wie im folgenden Beispiel gezeigt:

aws cloudfront create-cloud-front-origin-access-identity \ --cloud-front-origin-access-identity-config file://OAI-config.json

Die Datei OAI-config.json ist ein JSON-Dokument im aktuellen Verzeichnis, das Folgendes enthält:

{ "CallerReference": "cli-example", "Comment": "Example OAI" }

Unabhängig davon, ob Sie die OAI-Konfiguration mit einem Befehlszeilenargument oder einer JSON-Datei angeben, ist die Ausgabe identisch:

{ "Location": "https://cloudfront.amazonaws.com/2019-03-26/origin-access-identity/cloudfront/E74FTE3AEXAMPLE", "ETag": "E2QWRUHEXAMPLE", "CloudFrontOriginAccessIdentity": { "Id": "E74FTE3AEXAMPLE", "S3CanonicalUserId": "cd13868f797c227fbea2830611a26fe0a21ba1b826ab4bed9b7771c9aEXAMPLE", "CloudFrontOriginAccessIdentityConfig": { "CallerReference": "cli-example", "Comment": "Example OAI" } } }

Das folgende Codebeispiel zeigt die Verwendung. create-connection-group

AWS CLI

Um eine Verbindungsgruppe in zu erstellen CloudFront

Im folgenden Beispiel für create-connection-group wird eine aktivierte Verbindungsgruppe erstellt, eine statische Anycast-IP-Liste angegeben und IPv6 deaktiviert.

aws cloudfront create-connection-group \ --name cg-with-anycast-ip-list \ --no-ipv6-enabled \ --enabled \ --anycast-ip-list-id aip_CCkW6gKrDiBD4n78123ABC \ --tags "Items=[{Key=abc,Value=123}]"

Ausgabe:

{ "ETag": "E23ZP02F085ABC", "ConnectionGroup": { "Id": "cg_2yb6uj74B4PCbfhT31WFdiSABC", "Name": "cg-with-anycast-ip-list", "Arn": "arn:aws:cloudfront::123456789012:connection-group/cg_2yb6uj74B4PCbfhT31WFdiSABC", "CreatedTime": "2025-06-16T16:25:50.061000+00:00", "LastModifiedTime": "2025-06-16T16:25:50.061000+00:00", "Tags": { "Items": [ { "Key": "abc", "Value": "123" } ] }, "Ipv6Enabled": false, "RoutingEndpoint": "dj6xusxq65abc.cloudfront.net", "AnycastIpListId": "aip_CCkW6gKrDiBD4n78123ABC", "Status": "InProgress", "Enabled": true, "IsDefault": false } }

Weitere Informationen finden Sie unter Benutzerdefinierte Verbindungsgruppe erstellen (optional) im Amazon CloudFront Developer Guide.

Das folgende Codebeispiel zeigt die Verwendung. create-distribution-tenant

AWS CLI

Beispiel 1: Um einen CloudFront Distributionsmandanten zu erstellen, der ein benutzerdefiniertes Zertifikat verwendet

Im folgenden create-distribution-tenant Beispiel wird ein CloudFront Verteilungsmandant erstellt, der Anpassungen zur Deaktivierung von WAF und zum Hinzufügen von Geoeinschränkungen festlegt und ein anderes TLS-Zertifikat verwendet.

aws cloudfront create-distribution-tenant \ --cli-input-json file://tenant.json

Inhalt von tenant.json:

{ "DistributionId": "E1XNX8R2GOAABC", "Domains": [ { "Domain": "example.com" } ], "Parameters": [ { "Name": "testParam", "Value": "defaultValue" } ], "ConnectionGroupId": "cg_2whCJoXMYCjHcxaLGrkllvyABC", "Enabled": false, "Tags": { "Items": [ { "Key": "tag", "Value": "tagValue" } ] }, "Name": "new-tenant-customizations", "Customizations": { "GeoRestrictions": { "Locations": ["DE"], "RestrictionType": "whitelist" }, "WebAcl": { "Action": "disable" }, "Certificate": { "Arn": "arn:aws:acm:us-east-1:123456789012:certificate/ec53f564-ea5a-4e4a-a0a2-e3c989449abc" } } }

Ausgabe:

{ "ETag": "E23ZP02F085ABC", "DistributionTenant": { "Id": "dt_2yN5tYwVbPKr7m2IB69M1yp1AB", "DistributionId": "E1XNX8R2GOAABC", "Name": "new-tenant-customizations", "Arn": "arn:aws:cloudfront::123456789012:distribution-tenant/dt_2yN5tYwVbPKr7m2IB69M1yp1AB", "Domains": [ { "Domain": "example.com", "Status": "active" } ], "Tags": { "Items": [ { "Key": "tag", "Value": "tagValue" } ] }, "Customizations": { "WebAcl": { "Action": "disable" }, "Certificate": { "Arn": "arn:aws:acm:us-east-1:123456789012:certificate/ec53f564-ea5a-4e4a-a0a2-e3c989449abc" }, "GeoRestrictions": { "RestrictionType": "whitelist", "Locations": [ "DE" ] } }, "Parameters": [ { "Name": "testParam", "Value": "defaultValue" } ], "ConnectionGroupId": "cg_2whCJoXMYCjHcxaLGrkllvyABC", "CreatedTime": "2025-06-11T17:20:06.432000+00:00", "LastModifiedTime": "2025-06-11T17:20:06.432000+00:00", "Enabled": false, "Status": "InProgress" } }

Beispiel 2: So erstellen Sie einen Distributionsmandanten mit einem übernommenen Zertifikat

Im folgenden Beispiel für create-distribution-tenant wird ein Distributionsmandant erstellt und ein übernommenes TLS-Zertifikat aus der Multi-Tenant-Distribution angegeben.

aws cloudfront create-distribution-tenant \ --cli-input-json file://tenant.json

Inhalt von tenant.json:

{ "DistributionId": "E1HVIAU7U12ABC", "Domains": [ { "Domain": "example.com" } ], "Parameters": [ { "Name": "tenantName", "Value": "first-tenant" } ], "Enabled": true, "Name": "new-tenant-no-cert" }

Ausgabe:

{ "ETag": "E23ZP02F0ABC", "DistributionTenant": { "Id": "dt_2zhRB0vBe0B72LZCVy1mgzI1AB", "DistributionId": "E1HVIAU7U12ABC", "Name": "new-tenant-no-cert", "Arn": "arn:aws:cloudfront::123456789012:distribution-tenant/dt_2zhRB0vBe0B72LZCVy1mgzI1AB", "Domains": [ { "Domain": "example.com", "Status": "active" } ], "Parameters": [ { "Name": "tenantName", "Value": "first-tenant" } ], "ConnectionGroupId": "cg_2yQEwpipGFN0hhA0ZemPabOABC", "CreatedTime": "2025-07-10T20:59:38.414000+00:00", "LastModifiedTime": "2025-07-10T20:59:38.414000+00:00", "Enabled": true, "Status": "InProgress" } }

Beispiel 3: So erstellen Sie einen CloudFront Verteilungsmandanten mit einem Validierungstoken CloudFront-hosted

Im folgenden create-distribution-tenant Beispiel wird ein Verteilungsmandant erstellt und ein CloudFront-hosted Validierungstoken für Ihren Domainnamen verwendet.

aws cloudfront create-distribution-tenant \ --cli-input-json file://tenant.json

Inhalt von tenant.json:

{ "DistributionId": "E2GJ5J9QN12ABC", "Domains": [ { "Domain": "example.com" } ], "Parameters": [ { "Name": "tenantName", "Value": "first-tenant" } ], "ConnectionGroupId": "cg_2yQEwpipGFN0hhA0ZemPabOABC", "Enabled": true, "Name": "new-tenant-cf-hosted", "ManagedCertificateRequest": { "ValidationTokenHost": "cloudfront" } }

Wichtig: Um diesen Befehl erfolgreich auszuführen, müssen Sie einen CNAME-DNS-Eintrag konfigurieren, der Ihre neue Domain (example.com) auf den Routing-Endpunkt der Verbindungsgruppe verweist, die dem Distributionsmandanten zugeordnet ist. Dieser CNAME-Eintrag muss ebenfalls weitergegeben werden, bevor diese Anfrage erfolgreich abgeschlossen werden CloudFront kann.

Ausgabe:

{ "ETag": "E23ZP02F0ABC", "DistributionTenant": { "Id": "dt_2zhStKrA524GvvTWJX92Ozl1AB", "DistributionId": "E2GJ5J9QN12ABC", "Name": "new-tenant-cf-hosted", "Arn": "arn:aws:cloudfront::123456789012:distribution-tenant/dt_2zhStKrA524GvvTWJX92Ozl1AB", "Domains": [ { "Domain": "example.com", "Status": "inactive" } ], "Parameters": [ { "Name": "tenantName", "Value": "first-tenant" } ], "ConnectionGroupId": "cg_2zhSaGatwwXjTjE42nneZzqABC", "CreatedTime": "2025-07-10T21:13:46.416000+00:00", "LastModifiedTime": "2025-07-10T21:13:46.416000+00:00", "Enabled": true, "Status": "InProgress" } }

Beispiel 4: So erstellen Sie einen CloudFront Distributionsmandanten mit einem selbst gehosteten Validierungstoken

Im folgenden create-distribution-tenant Beispiel wird ein CloudFront Distributionsmandant erstellt und ein selbst gehostetes Validierungstoken verwendet.

aws cloudfront create-distribution-tenant \ --cli-input-json file://tenant.json

Inhalt von tenant.json:

{ "DistributionId": "E2GJ5J9QN12ABC", "Domains": [ { "Domain": "example.com" } ], "Parameters": [ { "Name": "tenantName", "Value": "first-tenant" } ], "Enabled": true, "Name": "new-tenant-self-hosted", "ManagedCertificateRequest": { "ValidationTokenHost": "self-hosted" } }

Ausgabe:

{ "ETag": "E23ZP02F0ABC", "DistributionTenant": { "Id": "dt_2zhTFBV93OfFJJ3YMdNM5BC1AB", "DistributionId": "E2GJ5J9QN12ABC", "Name": "new-tenant-self-hosted", "Arn": "arn:aws:cloudfront::123456789012:distribution-tenant/dt_2zhTFBV93OfFJJ3YMdNM5BC1AB", "Domains": [ { "Domain": "example.com", "Status": "inactive" } ], "Parameters": [ { "Name": "tenantName", "Value": "first-tenant" } ], "ConnectionGroupId": "cg_2yQEwpipGFN0hhA0ZemPabOABC", "CreatedTime": "2025-07-10T21:16:39.828000+00:00", "LastModifiedTime": "2025-07-10T21:16:39.828000+00:00", "Enabled": true, "Status": "InProgress" } }

Wichtig: Nachdem Sie diesen Befehl ausgeführt haben, wird der Distributionsmandant ohne Validierung erstellt. Informationen zur Validierung der verwalteten Zertifikatsanforderung und zur Konfiguration des DNS, wenn Sie bereit sind, Traffic zu empfangen, finden Sie unter Vollständige Domaineinrichtung im Amazon CloudFront Developer Guide.

Weitere Informationen zum Erstellen von Distributionsmandanten finden Sie unter Erstellen einer Distribution im Amazon CloudFront Developer Guide.

Das folgende Codebeispiel zeigt, wie man. create-distribution-with-tags

AWS CLI

Um eine CloudFront Distribution mit Tags zu erstellen

Im folgenden Beispiel für create-distribution-with-tags wird eine Distribution mit zwei Tags erstellt, indem die Distributionskonfiguration und die Tags in einer JSON-Datei mit dem Namen dist-config-with-tags.json bereitgestellt werden.

aws cloudfront create-distribution-with-tags \ --distribution-config-with-tags file://dist-config-with-tags.json

Die Datei dist-config-with-tags.json ist ein JSON-Dokument im aktuellen Ordner. Beachten Sie das Objekt Tags oben in der Datei, das zwei Tags enthält:

Name = ExampleDistributionProject = ExampleProject

Inhalt von dist-config-with-tags.json:

{ "Tags": { "Items": [ { "Key": "Name", "Value": "ExampleDistribution" }, { "Key": "Project", "Value": "ExampleProject" } ] }, "DistributionConfig": { "CallerReference": "cli-example", "Aliases": { "Quantity": 0 }, "DefaultRootObject": "index.html", "Origins": { "Quantity": 1, "Items": [ { "Id": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example", "DomainName": "amzn-s3-demo-bucket.s3.amazonaws.com", "OriginPath": "", "CustomHeaders": { "Quantity": 0 }, "S3OriginConfig": { "OriginAccessIdentity": "" } } ] }, "OriginGroups": { "Quantity": 0 }, "DefaultCacheBehavior": { "TargetOriginId": "amzn-s3-demo-bucket.s3.amazonaws.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 } }

Ausgabe:

{ "Location": "https://cloudfront.amazonaws.com/2019-03-26/distribution/EDFDVBD6EXAMPLE", "ETag": "E2QWRUHEXAMPLE", "Distribution": { "Id": "EDFDVBD6EXAMPLE", "ARN": "arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE", "Status": "InProgress", "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": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example", "DomainName": "amzn-s3-demo-bucket.s3.amazonaws.com", "OriginPath": "", "CustomHeaders": { "Quantity": 0 }, "S3OriginConfig": { "OriginAccessIdentity": "" } } ] }, "OriginGroups": { "Quantity": 0 }, "DefaultCacheBehavior": { "TargetOriginId": "amzn-s3-demo-bucket.s3.amazonaws.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 } } }

Das folgende Codebeispiel zeigt die Verwendung. create-distribution

AWS CLI

Beispiel 1: Um eine CloudFront Distribution zu erstellen

Im folgenden create-distribution-Beispiel wird eine Distribution für einen S3-Bucket mit dem Namen amzn-s3-demo-bucket erstellt und index.html als Standardstammobjekt mithilfe von Befehlszeilenargumenten festgelegt.

aws cloudfront create-distribution \ --origin-domain-name amzn-s3-demo-bucket.s3.amazonaws.com \ --default-root-object index.html

Ausgabe:

{ "Location": "https://cloudfront.amazonaws.com/2019-03-26/distribution/EMLARXS9EXAMPLE", "ETag": "E9LHASXEXAMPLE", "Distribution": { "Id": "EMLARXS9EXAMPLE", "ARN": "arn:aws:cloudfront::123456789012:distribution/EMLARXS9EXAMPLE", "Status": "InProgress", "LastModifiedTime": "2019-11-22T00:55:15.705Z", "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": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example", "DomainName": "amzn-s3-demo-bucket.s3.amazonaws.com", "OriginPath": "", "CustomHeaders": { "Quantity": 0 }, "S3OriginConfig": { "OriginAccessIdentity": "" } } ] }, "OriginGroups": { "Quantity": 0 }, "DefaultCacheBehavior": { "TargetOriginId": "amzn-s3-demo-bucket.s3.amazonaws.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 } } }

Beispiel 2: Um eine CloudFront Distribution mit einer JSON-Datei zu erstellen

Im folgenden create-distribution-Beispiel wird eine Distribution für einen S3-Bucket mit dem Namen amzn-s3-demo-bucket erstellt und index.html als Standardstammobjekt mithilfe einer JSON-Datei festgelegt.

aws cloudfront create-distribution \ --distribution-config file://dist-config.json

Inhalt von dist-config.json:

{ "CallerReference": "cli-example", "Aliases": { "Quantity": 0 }, "DefaultRootObject": "index.html", "Origins": { "Quantity": 1, "Items": [ { "Id": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example", "DomainName": "amzn-s3-demo-bucket.s3.amazonaws.com", "OriginPath": "", "CustomHeaders": { "Quantity": 0 }, "S3OriginConfig": { "OriginAccessIdentity": "" } } ] }, "OriginGroups": { "Quantity": 0 }, "DefaultCacheBehavior": { "TargetOriginId": "amzn-s3-demo-bucket.s3.amazonaws.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 }

Eine Beispielausgabe finden Sie in Beispiel 1.

Beispiel 3: Um eine CloudFront Multi-Tenant-Distribution mit einem Zertifikat zu erstellen

Im folgenden create-distribution Beispiel wird eine CloudFront Distribution mit Mehrmandantenunterstützung erstellt und ein TLS-Zertifikat angegeben.

aws cloudfront create-distribution \ --distribution-config file://dist-config.json

Inhalt von dist-config.json:

{ "CallerReference": "cli-example-with-cert", "Comment": "CLI example distribution", "DefaultRootObject": "index.html", "Origins": { "Quantity": 1, "Items": [ { "Id": "amzn-s3-demo-bucket.s3.us-east-1.amazonaws.com", "DomainName": "amzn-s3-demo-bucket.s3.us-east-1.amazonaws.com", "OriginPath": "/{{tenantName}}", "CustomHeaders": { "Quantity": 0 }, "S3OriginConfig": { "OriginAccessIdentity": "" } } ] }, "DefaultCacheBehavior": { "TargetOriginId": "amzn-s3-demo-bucket.s3.us-east-1.amazonaws.com", "CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e5ABC", "ViewerProtocolPolicy": "allow-all", "AllowedMethods": { "Quantity": 2, "Items": ["HEAD", "GET"], "CachedMethods": { "Quantity": 2, "Items": ["HEAD", "GET"] } } }, "Enabled": true, "ViewerCertificate": { "ACMCertificateArn": "arn:aws:acm:us-east-1:123456789012:certificate/191306a1-db01-49ca-90ef-fc414ee5dabc", "SSLSupportMethod": "sni-only" }, "HttpVersion": "http2", "ConnectionMode": "tenant-only", "TenantConfig": { "ParameterDefinitions": [ { "Name": "tenantName", "Definition": { "StringSchema": { "Comment": "tenantName parameter", "DefaultValue": "root", "Required": false } } } ] } }

Ausgabe:

{ "Location": "https://cloudfront.amazonaws.com/2020-05-31/distribution/E1HVIAU7UABC", "ETag": "E20LT7R1BABC", "Distribution": { "Id": "E1HVIAU7U12ABC", "ARN": "arn:aws:cloudfront::123456789012:distribution/E1HVIAU7U12ABC", "Status": "InProgress", "LastModifiedTime": "2025-07-10T20:33:31.117000+00:00", "InProgressInvalidationBatches": 0, "DomainName": "example.com", "ActiveTrustedSigners": { "Enabled": false, "Quantity": 0 }, "ActiveTrustedKeyGroups": { "Enabled": false, "Quantity": 0 }, "DistributionConfig": { "CallerReference": "cli-example-with-cert", "DefaultRootObject": "index.html", "Origins": { "Quantity": 1, "Items": [ { "Id": "amzn-s3-demo-bucket.s3.us-east-1.amazonaws.com", "DomainName": "amzn-s3-demo-bucket.s3.us-east-1.amazonaws.com", "OriginPath": "/{{tenantName}}", "CustomHeaders": { "Quantity": 0 }, "S3OriginConfig": { "OriginAccessIdentity": "" }, "ConnectionAttempts": 3, "ConnectionTimeout": 10, "OriginShield": { "Enabled": false }, "OriginAccessControlId": "" } ] }, "OriginGroups": { "Quantity": 0 }, "DefaultCacheBehavior": { "TargetOriginId": "amzn-s3-demo-bucket.s3.us-east-1.amazonaws.com", "TrustedKeyGroups": { "Enabled": false, "Quantity": 0 }, "ViewerProtocolPolicy": "allow-all", "AllowedMethods": { "Quantity": 2, "Items": ["HEAD", "GET"], "CachedMethods": { "Quantity": 2, "Items": ["HEAD", "GET"] } }, "Compress": false, "LambdaFunctionAssociations": { "Quantity": 0 }, "FunctionAssociations": { "Quantity": 0 }, "FieldLevelEncryptionId": "", "CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e5ABC", "GrpcConfig": { "Enabled": false } }, "CacheBehaviors": { "Quantity": 0 }, "CustomErrorResponses": { "Quantity": 0 }, "Comment": "CLI example distribution", "Logging": { "Enabled": false, "IncludeCookies": false, "Bucket": "", "Prefix": "" }, "Enabled": true, "ViewerCertificate": { "CloudFrontDefaultCertificate": false, "ACMCertificateArn": "arn:aws:acm:us-east-1:123456789012:certificate/1954f095-11b6-4daf-9952-0c308a00abc", "SSLSupportMethod": "sni-only", "MinimumProtocolVersion": "TLSv1.2_2021", "Certificate": "arn:aws:acm:us-east-1:123456789012:certificate/1954f095-11b6-4daf-9952-0c308a00abc", "CertificateSource": "acm" }, "Restrictions": { "GeoRestriction": { "RestrictionType": "none", "Quantity": 0 } }, "WebACLId": "", "HttpVersion": "http2", "TenantConfig": { "ParameterDefinitions": [ { "Name": "tenantName", "Definition": { "StringSchema": { "Comment": "tenantName parameter", "DefaultValue": "root", "Required": false } } } ] }, "ConnectionMode": "tenant-only" } } }

Weitere Informationen finden Sie unter Arbeiten mit Distributionen im Amazon CloudFront Developer Guide.

Beispiel 4: So erstellen Sie eine CloudFront Multi-Tenant-Distribution ohne Zertifikat

Im folgenden create-distribution Beispiel wird eine CloudFront Distribution mit Mehrmandantenunterstützung, aber ohne TLS-Zertifikat erstellt.

aws cloudfront create-distribution \ --distribution-config file://dist-config.json

Inhalt von dist-config.json:

{ "CallerReference": "cli-example", "Comment": "CLI example distribution", "DefaultRootObject": "index.html", "Origins": { "Quantity": 1, "Items": [ { "Id": "amzn-s3-demo-bucket.s3.us-east-1.amazonaws.com", "DomainName": "amzn-s3-demo-bucket.s3.us-east-1.amazonaws.com", "OriginPath": "/{{tenantName}}", "CustomHeaders": { "Quantity": 0 }, "S3OriginConfig": { "OriginAccessIdentity": "" } } ] }, "DefaultCacheBehavior": { "TargetOriginId": "amzn-s3-demo-bucket.s3.us-east-1.amazonaws.com", "CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e5ABC", "ViewerProtocolPolicy": "allow-all", "AllowedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ], "CachedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ] } } }, "Enabled": true, "HttpVersion": "http2", "ConnectionMode": "tenant-only", "TenantConfig": { "ParameterDefinitions": [ { "Name": "tenantName", "Definition": { "StringSchema": { "Comment": "tenantName parameter", "DefaultValue": "root", "Required": false } } } ] } }

Ausgabe:

{ "Location": "https://cloudfront.amazonaws.com/2020-05-31/distribution/E2GJ5J9QN12ABC", "ETag": "E37YLVVQIABC", "Distribution": { "Id": "E2GJ5J9QNABC", "ARN": "arn:aws:cloudfront::123456789012:distribution/E2GJ5J9QN12ABC", "Status": "InProgress", "LastModifiedTime": "2025-07-10T20:35:20.565000+00:00", "InProgressInvalidationBatches": 0, "DomainName": "example.com", "ActiveTrustedSigners": { "Enabled": false, "Quantity": 0 }, "ActiveTrustedKeyGroups": { "Enabled": false, "Quantity": 0 }, "DistributionConfig": { "CallerReference": "cli-example-no-cert", "DefaultRootObject": "index.html", "Origins": { "Quantity": 1, "Items": [ { "Id": "amzn-s3-demo-bucket.s3.us-east-1.amazonaws.com", "DomainName": "amzn-s3-demo-bucket.s3.us-east-1.amazonaws.com", "OriginPath": "/{{tenantName}}", "CustomHeaders": { "Quantity": 0 }, "S3OriginConfig": { "OriginAccessIdentity": "" }, "ConnectionAttempts": 3, "ConnectionTimeout": 10, "OriginShield": { "Enabled": false }, "OriginAccessControlId": "" } ] }, "OriginGroups": { "Quantity": 0 }, "DefaultCacheBehavior": { "TargetOriginId": "amzn-s3-demo-bucket.s3.us-east-1.amazonaws.com", "TrustedKeyGroups": { "Enabled": false, "Quantity": 0 }, "ViewerProtocolPolicy": "allow-all", "AllowedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ], "CachedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ] } }, "Compress": false, "LambdaFunctionAssociations": { "Quantity": 0 }, "FunctionAssociations": { "Quantity": 0 }, "FieldLevelEncryptionId": "", "CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e5ABC", "GrpcConfig": { "Enabled": false } }, "CacheBehaviors": { "Quantity": 0 }, "CustomErrorResponses": { "Quantity": 0 }, "Comment": "CLI example distribution", "Logging": { "Enabled": false, "IncludeCookies": false, "Bucket": "", "Prefix": "" }, "Enabled": true, "ViewerCertificate": { "CloudFrontDefaultCertificate": true, "SSLSupportMethod": "sni-only", "MinimumProtocolVersion": "TLSv1", "CertificateSource": "cloudfront" }, "Restrictions": { "GeoRestriction": { "RestrictionType": "none", "Quantity": 0 } }, "WebACLId": "", "HttpVersion": "http2", "TenantConfig": { "ParameterDefinitions": [ { "Name": "tenantName", "Definition": { "StringSchema": { "Comment": "tenantName parameter", "DefaultValue": "root", "Required": false } } } ] }, "ConnectionMode": "tenant-only" } } }

Weitere Informationen finden Sie unter Distributionen konfigurieren im Amazon CloudFront Developer Guide.

Das folgende Codebeispiel zeigt die Verwendung. create-field-level-encryption-config

AWS CLI

Um eine Verschlüsselungskonfiguration auf CloudFront Feldebene zu erstellen

Im folgenden Beispiel wird eine Verschlüsselungskonfiguration auf Feldebene erstellt, indem die Konfigurationsparameter in einer JSON-Datei mit dem Namen fle-config.json bereitgestellt werden. Bevor Sie eine Verschlüsselungskonfiguration auf Feldebene erstellen können, müssen Sie über ein Verschlüsselungsprofil auf Feldebene verfügen. Informationen zum Erstellen eines Profils finden Sie unter dem Befehl create-field-level-encryption-profile.

Weitere Informationen zur Verschlüsselung auf CloudFront Feldebene finden Sie unter Field-Level Verschlüsselung zum Schutz vertraulicher Daten verwenden im Amazon CloudFront Developer Guide.

aws cloudfront create-field-level-encryption-config \ --field-level-encryption-config file://fle-config.json

Die Datei fle-config.json ist ein JSON-Dokument im aktuellen Verzeichnis, das Folgendes enthält:

{ "CallerReference": "cli-example", "Comment": "Example FLE configuration", "QueryArgProfileConfig": { "ForwardWhenQueryArgProfileIsUnknown": true, "QueryArgProfiles": { "Quantity": 0 } }, "ContentTypeProfileConfig": { "ForwardWhenContentTypeIsUnknown": true, "ContentTypeProfiles": { "Quantity": 1, "Items": [ { "Format": "URLEncoded", "ProfileId": "P280MFCLSYOCVU", "ContentType": "application/x-www-form-urlencoded" } ] } } }

Ausgabe:

{ "Location": "https://cloudfront.amazonaws.com/2019-03-26/field-level-encryption/C3KM2WVD605UAY", "ETag": "E2P4Z4VU7TY5SG", "FieldLevelEncryption": { "Id": "C3KM2WVD605UAY", "LastModifiedTime": "2019-12-10T21:30:18.974Z", "FieldLevelEncryptionConfig": { "CallerReference": "cli-example", "Comment": "Example FLE configuration", "QueryArgProfileConfig": { "ForwardWhenQueryArgProfileIsUnknown": true, "QueryArgProfiles": { "Quantity": 0, "Items": [] } }, "ContentTypeProfileConfig": { "ForwardWhenContentTypeIsUnknown": true, "ContentTypeProfiles": { "Quantity": 1, "Items": [ { "Format": "URLEncoded", "ProfileId": "P280MFCLSYOCVU", "ContentType": "application/x-www-form-urlencoded" } ] } } } } }

Das folgende Codebeispiel zeigt die Verwendung. create-field-level-encryption-profile

AWS CLI

Um ein Verschlüsselungsprofil auf CloudFront Feldebene zu erstellen

Im folgenden Beispiel wird ein Verschlüsselungsprofil auf Feldebene erstellt, indem die Parameter in einer JSON-Datei mit dem Namen fle-profile-config.json bereitgestellt werden. Bevor Sie ein Verschlüsselungsprofil auf Feldebene erstellen können, benötigen Sie einen öffentlichen Schlüssel. CloudFront Informationen zum Erstellen eines CloudFront öffentlichen Schlüssels finden Sie unter dem Befehl create-public-key.

Weitere Informationen zur Verschlüsselung auf CloudFront Feldebene finden Sie unter Field-Level Verschlüsselung zum Schutz vertraulicher Daten verwenden im Amazon CloudFront Developer Guide.

aws cloudfront create-field-level-encryption-profile \ --field-level-encryption-profile-config file://fle-profile-config.json

Die Datei fle-profile-config.json ist ein JSON-Dokument im aktuellen Verzeichnis, das Folgendes enthält:

{ "Name": "ExampleFLEProfile", "CallerReference": "cli-example", "Comment": "FLE profile for AWS CLI example", "EncryptionEntities": { "Quantity": 1, "Items": [ { "PublicKeyId": "K2K8NC4HVFE3M0", "ProviderId": "ExampleFLEProvider", "FieldPatterns": { "Quantity": 1, "Items": [ "ExampleSensitiveField" ] } } ] } }

Ausgabe:

{ "Location": "https://cloudfront.amazonaws.com/2019-03-26/field-level-encryption-profile/PPK0UOSIF5WSV", "ETag": "E2QWRUHEXAMPLE", "FieldLevelEncryptionProfile": { "Id": "PPK0UOSIF5WSV", "LastModifiedTime": "2019-12-10T01:03:16.537Z", "FieldLevelEncryptionProfileConfig": { "Name": "ExampleFLEProfile", "CallerReference": "cli-example", "Comment": "FLE profile for AWS CLI example", "EncryptionEntities": { "Quantity": 1, "Items": [ { "PublicKeyId": "K2K8NC4HVFE3M0", "ProviderId": "ExampleFLEProvider", "FieldPatterns": { "Quantity": 1, "Items": [ "ExampleSensitiveField" ] } } ] } } } }

Das folgende Codebeispiel zeigt die Verwendung. create-invalidation-for-distribution-tenant

AWS CLI

Um eine CloudFront Invalidierung für einen Distributionsmandanten zu erstellen

Im folgenden create-invalidation-for-distribution-tenant Beispiel wird eine Invalidierung für alle Dateien in einem CloudFront Verteilungsmandanten erstellt.

aws cloudfront create-invalidation-for-distribution-tenant \ --id dt_2wjDZi3hD1ivOXf6rpZJO1AB \ --invalidation-batch '{"Paths": {"Quantity": 1, "Items": ["/*"]}, "CallerReference": "invalidation-$(date +%s)"}'

Ausgabe:

{ "Location": "https://cloudfront.amazonaws.com/2020-05-31/distribution-tenant/dt_2wjDZi3hD1ivOXf6rpZJO1AB/invalidation/I2JGL2F1ZAA426PGG0YLLKABC", "Invalidation": { "Id": "I2JGL2F1ZAA426PGG0YLLKABC", "Status": "InProgress", "CreateTime": "2025-05-07T16:59:25.947000+00:00", "InvalidationBatch": { "Paths": { "Quantity": 1, "Items": [ "/*" ] }, "CallerReference": "invalidation-$(date +%s)" } } }

Weitere Informationen finden Sie unter Dateien für ungültig erklären, um Inhalte zu entfernen im Amazon CloudFront Developer Guide.

Das folgende Codebeispiel zeigt die Verwendung. create-invalidation

AWS CLI

Um eine Invalidierung für eine CloudFront Distribution zu erstellen

Das folgende create-invalidation Beispiel erstellt eine Invalidierung für die angegebenen Dateien in der angegebenen CloudFront Distribution:

aws cloudfront create-invalidation \ --distribution-id EDFDVBD6EXAMPLE \ --paths "/example-path/example-file.jpg" "/example-path/example-file2.png"

Ausgabe:

{ "Location": "https://cloudfront.amazonaws.com/2019-03-26/distribution/EDFDVBD6EXAMPLE/invalidation/I1JLWSDAP8FU89", "Invalidation": { "Id": "I1JLWSDAP8FU89", "Status": "InProgress", "CreateTime": "2019-12-05T18:24:51.407Z", "InvalidationBatch": { "Paths": { "Quantity": 2, "Items": [ "/example-path/example-file2.png", "/example-path/example-file.jpg" ] }, "CallerReference": "cli-1575570291-670203" } } }

Im vorherigen Beispiel generierte die AWS CLI automatisch ein zufälliges ErgebnisCallerReference. Wenn Sie Ihre eigene CallerReference angeben oder die Invalidierungsparameter nicht als Befehlszeilenargumente übergeben möchten, können Sie eine JSON-Datei verwenden. Im folgende Beispiel wird eine Invalidierung für zwei Dateien erstellt, indem die Invalidierungsparameter in einer JSON-Datei mit dem Namen inv-batch.json angegeben werden.

aws cloudfront create-invalidation \ --distribution-id EDFDVBD6EXAMPLE \ --invalidation-batch file://inv-batch.json

Inhalt von inv-batch.json:

{ "Paths": { "Quantity": 2, "Items": [ "/example-path/example-file.jpg", "/example-path/example-file2.png" ] }, "CallerReference": "cli-example" }

Ausgabe:

{ "Location": "https://cloudfront.amazonaws.com/2019-03-26/distribution/EDFDVBD6EXAMPLE/invalidation/I2J0I21PCUYOIK", "Invalidation": { "Id": "I2J0I21PCUYOIK", "Status": "InProgress", "CreateTime": "2019-12-05T18:40:49.413Z", "InvalidationBatch": { "Paths": { "Quantity": 2, "Items": [ "/example-path/example-file.jpg", "/example-path/example-file2.png" ] }, "CallerReference": "cli-example" } } }

Das folgende Codebeispiel zeigt, wie man es benutzt. create-public-key

AWS CLI

Um einen CloudFront öffentlichen Schlüssel zu erstellen

Im folgenden Beispiel wird ein CloudFront öffentlicher Schlüssel erstellt, indem die Parameter in einer JSON-Datei mit dem Namen bereitgestellt pub-key-config.json werden. Bevor Sie diesen Befehl verwenden können, benötigen Sie einen PEM-encoded öffentlichen Schlüssel. Weitere Informationen finden Sie unter Create an RSA Key Pair im Amazon CloudFront Developer Guide.

aws cloudfront create-public-key \ --public-key-config file://pub-key-config.json

Die Datei pub-key-config.json ist ein JSON-Dokument im aktuellen Ordner, das Folgendes enthält. Beachten Sie, dass der öffentliche Schlüssel im PEM-Format verschlüsselt ist.

{ "CallerReference": "cli-example", "Name": "ExampleKey", "EncodedKey": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxPMbCA2Ks0lnd7IR+3pw\nwd3H/7jPGwj8bLUmore7bX+oeGpZ6QmLAe/1UOWcmZX2u70dYcSIzB1ofZtcn4cJ\nenHBAzO3ohBY/L1tQGJfS2A+omnN6H16VZE1JCK8XSJyfze7MDLcUyHZETdxuvRb\nA9X343/vMAuQPnhinFJ8Wdy8YBXSPpy7r95ylUQd9LfYTBzVZYG2tSesplcOkjM3\n2Uu+oMWxQAw1NINnSLPinMVsutJy6ZqlV3McWNWe4T+STGtWhrPNqJEn45sIcCx4\nq+kGZ2NQ0FyIyT2eiLKOX5Rgb/a36E/aMk4VoDsaenBQgG7WLTnstb9sr7MIhS6A\nrwIDAQAB\n-----END PUBLIC KEY-----\n", "Comment": "example public key" }

Ausgabe:

{ "Location": "https://cloudfront.amazonaws.com/2019-03-26/public-key/KDFB19YGCR002", "ETag": "E2QWRUHEXAMPLE", "PublicKey": { "Id": "KDFB19YGCR002", "CreatedTime": "2019-12-05T18:51:43.781Z", "PublicKeyConfig": { "CallerReference": "cli-example", "Name": "ExampleKey", "EncodedKey": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxPMbCA2Ks0lnd7IR+3pw\nwd3H/7jPGwj8bLUmore7bX+oeGpZ6QmLAe/1UOWcmZX2u70dYcSIzB1ofZtcn4cJ\nenHBAzO3ohBY/L1tQGJfS2A+omnN6H16VZE1JCK8XSJyfze7MDLcUyHZETdxuvRb\nA9X343/vMAuQPnhinFJ8Wdy8YBXSPpy7r95ylUQd9LfYTBzVZYG2tSesplcOkjM3\n2Uu+oMWxQAw1NINnSLPinMVsutJy6ZqlV3McWNWe4T+STGtWhrPNqJEn45sIcCx4\nq+kGZ2NQ0FyIyT2eiLKOX5Rgb/a36E/aMk4VoDsaenBQgG7WLTnstb9sr7MIhS6A\nrwIDAQAB\n-----END PUBLIC KEY-----\n", "Comment": "example public key" } } }

Das folgende Codebeispiel zeigt die Verwendung. delete-cloud-front-origin-access-identity

AWS CLI

Um eine CloudFront ursprüngliche Zugriffsidentität zu löschen

Im folgenden Beispiel wird die Ursprungszugriffsidentität (OAI) mit der ID E74FTE3AEXAMPLE gelöscht. Um eine OAI zu löschen, benötigen Sie die ID und das ETag der OAI. Die OAI-ID wird in der Ausgabe der Befehle create-cloud-front-origin-access-identity und list-cloud-front-origin-access-identities zurückgegeben. Verwenden Sie den Befehl get-cloud-front-origin-access-identity oder get-cloud-front-origin-access-identity-config, um das ETag abzurufen. Verwenden Sie die Option --if-match, um das OAI-ETag bereitzustellen.

aws cloudfront delete-cloud-front-origin-access-identity \ --id E74FTE3AEXAMPLE \ --if-match E2QWRUHEXAMPLE

Bei erfolgreicher Ausführung gibt dieser Befehl keine Ausgabe aus.

Das folgende Codebeispiel zeigt die Verwendung. delete-connection-group

AWS CLI

So löschen Sie eine Verbindungsgruppe

Im folgenden Beispiel für delete-connection-group wird eine Verbindungsgruppe gelöscht. Die Verbindungsgruppe muss deaktiviert sein und kann keinen CloudFront Ressourcen zugeordnet werden.

aws cloudfront delete-connection-group \ --id cg_2wjLpjbHkLUdhWAjHllcOeABC \ --if-match ETVPDKIKX0DABC

Bei erfolgreicher Ausführung gibt dieser Befehl keine Ausgabe aus.

Weitere Informationen zur Verwaltung von Verbindungsgruppen finden Sie unter Benutzerdefinierte Verbindungsgruppe erstellen (optional) im Amazon CloudFront Developer Guide.

Das folgende Codebeispiel zeigt die Verwendung. delete-distribution-tenant

AWS CLI

So löschen Sie einen Distributionsmandanten

Im folgenden Beispiel für delete-distribution-tenant wird ein Distributionsmandant mit ETag ETVPDKIKX0DABC gelöscht. Der Verteilungsmandant muss deaktiviert sein und kann keinen CloudFront Ressourcen zugeordnet werden.

aws cloudfront delete-distribution-tenant \ --id dt_2wjMUbg3NHZEQ7OfoalP5zi1AB \ --if-match ETVPDKIKX0DABC

Bei erfolgreicher Ausführung gibt dieser Befehl keine Ausgabe aus.

Weitere Informationen finden Sie unter Löschen einer Distribution im Amazon CloudFront Developer Guide.

Das folgende Codebeispiel zeigt die Verwendung. delete-distribution

AWS CLI

Um eine CloudFront Distribution zu löschen

Im folgenden Beispiel wird die CloudFront Distribution mit der ID EDFDVBD6EXAMPLE gelöscht. Bevor Sie eine Distribution löschen können, müssen Sie sie deaktivieren. Verwenden Sie zum Deaktivieren einer Distribution den Befehl „update-distribution“. Weitere Informationen finden Sie in den Beispielen zu „update-distribution“.

Wenn eine Distribution deaktiviert ist, können Sie sie löschen. Um eine Distribution zu löschen, müssen Sie die --if-match-Option verwenden, um den ETag der Distribution anzugeben. Um den ETag zu erhalten, verwenden Sie bitte den Befehl „get-Distribution“ oder „get-Distribution-Config“.

aws cloudfront delete-distribution \ --id EDFDVBD6EXAMPLE \ --if-match E2QWRUHEXAMPLE

Bei erfolgreicher Ausführung gibt dieser Befehl keine Ausgabe aus.

Das folgende Codebeispiel zeigt, wie man. delete-field-level-encryption-config

AWS CLI

Um eine Verschlüsselungskonfiguration auf CloudFront Feldebene zu löschen

Im folgenden Beispiel wird die Verschlüsselungskonfiguration auf CloudFront Feldebene mit der ID gelöscht. C3KM2WVD605UAY Um eine Verschlüsselungskonfiguration auf Feldebene zu löschen, benötigen Sie die zugehörige ID und das ETag. Die ID wird in der Ausgabe der Befehle „create-field-level-encryption-config“ und „list-field-level-encryption-configs“ zurückgegeben. Verwenden Sie den Befehl „get-field-level-encryption“ oder „get-field-level-encryption-config“, um das ETag abzurufen. Verwenden Sie die Option --if-match, um das ETag der Konfiguration bereitzustellen.

aws cloudfront delete-field-level-encryption-config \ --id C3KM2WVD605UAY \ --if-match E26M4BIAV81ZF6

Bei erfolgreicher Ausführung gibt dieser Befehl keine Ausgabe aus.

Das folgende Codebeispiel zeigt die Verwendung. delete-field-level-encryption-profile

AWS CLI

Um ein Verschlüsselungsprofil auf CloudFront Feldebene zu löschen

Im folgenden Beispiel wird das Verschlüsselungsprofil auf CloudFront Feldebene mit der ID gelöscht. PPK0UOSIF5WSV Um ein Verschlüsselungsprofil auf Feldebene zu löschen, benötigen Sie die zugehörige ID und das ETag. Die ID wird in der Ausgabe der Befehle „create-field-level-encryption-profile“ und „list-field-level-encryption-profiles“ zurückgegeben. Verwenden Sie den Befehl „get-field-level-encryption-profile“ oder „get-field-level-encryption-profile-config“, um das ETag abzurufen. Verwenden Sie die Option --if-match, um das ETag des Profils bereitzustellen.

aws cloudfront delete-field-level-encryption-profile \ --id PPK0UOSIF5WSV \ --if-match EJETYFJ9CL66D

Bei erfolgreicher Ausführung gibt dieser Befehl keine Ausgabe aus.

Das folgende Codebeispiel zeigt die Verwendung. delete-public-key

AWS CLI

Um einen CloudFront öffentlichen Schlüssel zu löschen

Im folgenden Beispiel wird der CloudFront öffentliche Schlüssel mit der ID KDFB19YGCR002 gelöscht. Um einen öffentlichen Schlüssel zu löschen, benötigen Sie seine ID und sein ETag. Die ID wird in der Ausgabe der Befehle „create-public-key“ und „list-public-keys“ zurückgegeben. Verwenden Sie den Befehl „get-public-key“ oder „get-public-key-config“, um das ETag abzurufen. Verwenden Sie die Option --if-match, um das ETag des öffentlichen Schlüssels bereitzustellen.

aws cloudfront delete-public-key \ --id KDFB19YGCR002 \ --if-match E2QWRUHEXAMPLE

Bei erfolgreicher Ausführung gibt dieser Befehl keine Ausgabe aus.

  • Einzelheiten zur API finden Sie DeletePublicKeyin der AWS CLI Befehlsreferenz.

Das folgende Codebeispiel zeigt die Verwendung. disassociate-distribution-tenant-web-acl

AWS CLI

So trennen Sie eine Web-ACL von einem Distributionsmandanten

Im folgenden Beispiel für disassociate-distribution-tenant-web-acl wird eine Web-ACL von einem Distributionsmandanten mit dem ETag E1PA6795UKMABC getrennt.

aws cloudfront disassociate-distribution-tenant-web-acl \ --id dt_2wjDZi3hD1ivOXf6rpZJOSNE1AB \ --if-match E1PA6795UKMABC

Ausgabe:

{ "ETag": "E13V1IB3VIYABC", "Id": "dt_2wjDZi3hD1ivOXf6rpZJOSNE1AB" }

Weitere Informationen finden Sie unter Deaktivieren AWS des WAF-Sicherheitsschutzes im Amazon CloudFront Developer Guide.

Das folgende Codebeispiel zeigt, wie man. disassociate-distribution-web-acl

AWS CLI

Um eine Web-ACL von einer CloudFront Distribution zu trennen

Im folgenden disassociate-distribution-web-acl Beispiel wird die Zuordnung zwischen einer Web-ACL und einer CloudFront Distribution mit ETag aufgehoben. E13V1IB3VIYABC

aws cloudfront disassociate-distribution-web-acl \ --id E1XNX8R2GOAABC \ --if-match EEZQ9Z24VM1ABC

Ausgabe:

{ "ETag": "E2YWS1C2J3OABC", "Id": "E1XNX8R2GOAABC" }

Weitere Informationen finden Sie unter Deaktivieren AWS des WAF-Sicherheitsschutzes im Amazon CloudFront Developer Guide.

Das folgende Codebeispiel zeigt, wie man. get-cloud-front-origin-access-identity-config

AWS CLI

Um eine Konfiguration der CloudFront Origin-Zugriffsidentität zu erhalten

Im folgenden Beispiel werden Metadaten zur CloudFront Origin-Zugriffsidentität (OAI) mit der ID abgerufenE74FTE3AEXAMPLE, einschließlich ihrerETag. Die OAI-ID wird in der Ausgabe der Befehle create-cloud-front-origin-access-identity und list-cloud-front-origin-access-identities zurückgegeben.

aws cloudfront get-cloud-front-origin-access-identity-config --id E74FTE3AEXAMPLE

Ausgabe:

{ "ETag": "E2QWRUHEXAMPLE", "CloudFrontOriginAccessIdentityConfig": { "CallerReference": "cli-example", "Comment": "Example OAI" } }

Das folgende Codebeispiel zeigt, wie man. get-cloud-front-origin-access-identity

AWS CLI

Um eine CloudFront ursprüngliche Zugriffsidentität zu erhalten

Im folgenden Beispiel wird die ursprüngliche CloudFront Zugriffsidentität (OAI) mit der ID abgerufenE74FTE3AEXAMPLE, einschließlich ihrer ETag und der zugehörigen kanonischen S3-ID. Die OAI-ID wird in der Ausgabe der Befehle create-cloud-front-origin-access-identity und list-cloud-front-origin-access-identities zurückgegeben.

aws cloudfront get-cloud-front-origin-access-identity --id E74FTE3AEXAMPLE

Ausgabe:

{ "ETag": "E2QWRUHEXAMPLE", "CloudFrontOriginAccessIdentity": { "Id": "E74FTE3AEXAMPLE", "S3CanonicalUserId": "cd13868f797c227fbea2830611a26fe0a21ba1b826ab4bed9b7771c9aEXAMPLE", "CloudFrontOriginAccessIdentityConfig": { "CallerReference": "cli-example", "Comment": "Example OAI" } } }

Das folgende Codebeispiel zeigt, wie man. get-connection-group-by-routing-endpoint

AWS CLI

So rufen Sie eine Verbindungsgruppe nach Routing-Endpunkt ab

Im folgenden Beispiel für get-connection-group-by-routing-endpoint werden Informationen über eine Verbindungsgruppe mithilfe ihres Routing-Endpunkts abgerufen.

aws cloudfront get-connection-group-by-routing-endpoint \ --routing-endpoint dvdg9gprgabc.cloudfront.net

Ausgabe:

{ "ETag": "E23ZP02F085ABC", "ConnectionGroup": { "Id": "cg_2wjDWTBKTlRB87cAaUQFaakABC", "Name": "connection-group-2", "Arn": "arn:aws:cloudfront::123456789012:connection-group/cg_2wjDWTBKTlRB87cAaUQFaakABC", "CreatedTime": "2025-05-06T15:42:00.790000+00:00", "LastModifiedTime": "2025-05-06T15:42:00.790000+00:00", "Ipv6Enabled": true, "RoutingEndpoint": "dvdg9gprgabc.cloudfront.net", "Status": "Deployed", "Enabled": true, "IsDefault": false } }

Weitere Informationen finden Sie unter Benutzerdefinierte Verbindungsgruppe erstellen (optional) im Amazon CloudFront Developer Guide.

Das folgende Codebeispiel zeigt, wie man. get-connection-group

AWS CLI

Um eine CloudFront Verbindungsgruppe zu erhalten

Im folgenden get-connection-group Beispiel werden Informationen über eine CloudFront Verbindungsgruppe abgerufen.

aws cloudfront get-connection-group \ --identifier cg_2wjDWTBKTlRB87cAaUQFaakABC

Ausgabe:

{ "ETag": "E23ZP02F085ABC", "ConnectionGroup": { "Id": "cg_2wjDWTBKTlRB87cAaUQFaakABC", "Name": "connection-group-2", "Arn": "arn:aws:cloudfront::123456789012:connection-group/cg_2wjDWTBKTlRB87cAaUQFaakABC", "CreatedTime": "2025-05-06T15:42:00.790000+00:00", "LastModifiedTime": "2025-05-06T15:42:00.790000+00:00", "Ipv6Enabled": true, "RoutingEndpoint": "dvdg9gprgabc.cloudfront.net", "Status": "Deployed", "Enabled": true, "IsDefault": false } }

Weitere Informationen finden Sie unter Benutzerdefinierte Verbindungsgruppe erstellen (optional) im Amazon CloudFront Developer Guide.

Das folgende Codebeispiel zeigt, wie man. get-distribution-config

AWS CLI

Um eine CloudFront Distributionskonfiguration zu erhalten

Im folgenden Beispiel werden Metadaten über die CloudFront Distribution mit der ID abgerufenEDFDVBD6EXAMPLE, einschließlich ihrerETag. Die Distributions-ID wird in den Befehlen „create-distribution“ und „list-distributions“ zurückgegeben.

aws cloudfront get-distribution-config \ --id EDFDVBD6EXAMPLE

Ausgabe:

{ "ETag": "E2QWRUHEXAMPLE", "DistributionConfig": { "CallerReference": "cli-example", "Aliases": { "Quantity": 0 }, "DefaultRootObject": "index.html", "Origins": { "Quantity": 1, "Items": [ { "Id": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example", "DomainName": "amzn-s3-demo-bucket.s3.amazonaws.com", "OriginPath": "", "CustomHeaders": { "Quantity": 0 }, "S3OriginConfig": { "OriginAccessIdentity": "" } } ] }, "OriginGroups": { "Quantity": 0 }, "DefaultCacheBehavior": { "TargetOriginId": "amzn-s3-demo-bucket.s3.amazonaws.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 } }

Das folgende Codebeispiel zeigt, wie man. get-distribution-tenant-by-domain

AWS CLI

So rufen Sie Informationen über den Distributionsmandanten nach Domain ab

Im folgenden Beispiel für get-distribution-tenant-by-domain werden Informationen über einen Distributionsmandanten abgerufen, der die angegebene Domain verwendet.

aws cloudfront get-distribution-tenant-by-domain \ --domain example.com

Ausgabe:

{ "ETag": "E23ZP02F085ABC", "DistributionTenant": { "Id": "dt_2xVInRKCfUzQHgxosDs9hiLk1AB", "DistributionId": "E1XNX8R2GOAABC", "Name": "example-tenant-4", "Arn": "arn:aws:cloudfront::123456789012:distribution-tenant/dt_2xVInRKCfUzQHgxosDs9hiLk1AB", "Domains": [ { "Domain": "example.com", "Status": "active" } ], "Parameters": [ { "Name": "testParam", "Value": "defaultValue" } ], "ConnectionGroupId": "cg_2whCJoXMYCjHcxaLGrkllvyABC", "CreatedTime": "2025-05-23T16:16:20.871000+00:00", "LastModifiedTime": "2025-05-23T16:16:20.871000+00:00", "Enabled": false, "Status": "Deployed" } }

Weitere Informationen finden Sie im Amazon CloudFront Developer Guide unter Grundlegendes zur Funktionsweise von Multi-Tenant-Distributionen.

Das folgende Codebeispiel zeigt, wie man. get-distribution-tenant

AWS CLI

Um Details zu einem CloudFront Distributionsmandanten abzurufen

Im folgenden get-distribution-tenant Beispiel werden Informationen über einen CloudFront Verteilungsmandanten abgerufen.

aws cloudfront get-distribution-tenant \ --id dt_2wjDZi3hD1ivOXf6rpZJOSNE1AB

Ausgabe:

{ "ETag": "E23ZP02F085ABC", "DistributionTenant": { "Id": "dt_2wjDZi3hD1ivOXf6rpZJOSNE1AB", "DistributionId": "E1XNX8R2GOAABC", "Name": "example-tenant-2", "Arn": "arn:aws:cloudfront::123456789012:distribution-tenant/dt_2wjDZi3hD1ivOXf6rpZJOSNE1AB", "Domains": [ { "Domain": "example.com", "Status": "inactive" } ], "ConnectionGroupId": "cg_2wjDWTBKTlRB87cAaUQFaakABC", "CreatedTime": "2025-05-06T15:42:28.542000+00:00", "LastModifiedTime": "2025-05-06T15:42:37.724000+00:00", "Enabled": true, "Status": "InProgress" } }

Weitere Informationen finden Sie im Amazon CloudFront Developer Guide unter Grundlegendes zur Funktionsweise von Multi-Tenant-Distributionen.

Das folgende Codebeispiel zeigt die Verwendungget-distribution.

AWS CLI

Um eine CloudFront Distribution zu erhalten

Im folgenden get-distribution Beispiel wird die CloudFront Distribution mit der ID abgerufenEDFDVBD6EXAMPLE, einschließlich ihrerETag. Die Distributions-ID wird in den Befehlen „create-distribution“ und „list-distributions“ zurückgegeben.

aws cloudfront get-distribution \ --id EDFDVBD6EXAMPLE

Ausgabe:

{ "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": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example", "DomainName": "amzn-s3-demo-bucket.s3.amazonaws.com", "OriginPath": "", "CustomHeaders": { "Quantity": 0 }, "S3OriginConfig": { "OriginAccessIdentity": "" } } ] }, "OriginGroups": { "Quantity": 0 }, "DefaultCacheBehavior": { "TargetOriginId": "amzn-s3-demo-bucket.s3.amazonaws.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 } } }
  • Einzelheiten zur API finden Sie GetDistributionin der AWS CLI Befehlsreferenz.

Das folgende Codebeispiel zeigt, wie man. get-field-level-encryption-config

AWS CLI

Um Metadaten zu einer Verschlüsselungskonfiguration auf CloudFront Feldebene abzurufen

Im folgenden Beispiel werden Metadaten über die Verschlüsselungskonfiguration auf CloudFront Feldebene mit der ID C3KM2WVD605UAY abgerufen, einschließlich ihrer: ETag

aws cloudfront get-field-level-encryption-config --id C3KM2WVD605UAY

Ausgabe:

{ "ETag": "E2P4Z4VU7TY5SG", "FieldLevelEncryptionConfig": { "CallerReference": "cli-example", "Comment": "Example FLE configuration", "QueryArgProfileConfig": { "ForwardWhenQueryArgProfileIsUnknown": true, "QueryArgProfiles": { "Quantity": 0, "Items": [] } }, "ContentTypeProfileConfig": { "ForwardWhenContentTypeIsUnknown": true, "ContentTypeProfiles": { "Quantity": 1, "Items": [ { "Format": "URLEncoded", "ProfileId": "P280MFCLSYOCVU", "ContentType": "application/x-www-form-urlencoded" } ] } } } }

Das folgende Codebeispiel zeigt, wie man. get-field-level-encryption-profile-config

AWS CLI

Um eine Konfiguration für ein Verschlüsselungsprofil CloudFront auf Feldebene zu erhalten

Im folgenden Beispiel werden Metadaten über das Verschlüsselungsprofil auf CloudFront Feldebene mit ID PPK0UOSIF5WSV abgerufen, einschließlich seiner: ETag

aws cloudfront get-field-level-encryption-profile-config --id PPK0UOSIF5WSV

Ausgabe:

{ "ETag": "E1QQG65FS2L2GC", "FieldLevelEncryptionProfileConfig": { "Name": "ExampleFLEProfile", "CallerReference": "cli-example", "Comment": "FLE profile for AWS CLI example", "EncryptionEntities": { "Quantity": 1, "Items": [ { "PublicKeyId": "K2K8NC4HVFE3M0", "ProviderId": "ExampleFLEProvider", "FieldPatterns": { "Quantity": 1, "Items": [ "ExampleSensitiveField" ] } } ] } } }

Das folgende Codebeispiel zeigt, wie man. get-field-level-encryption-profile

AWS CLI

Um ein Verschlüsselungsprofil auf CloudFront Feldebene zu erhalten

Im folgenden Beispiel wird das Verschlüsselungsprofil auf CloudFront Feldebene mit der ID PPK0UOSIF5WSV abgerufen, einschließlich seiner: ETag

aws cloudfront get-field-level-encryption-profile --id PPK0UOSIF5WSV

Ausgabe:

{ "ETag": "E1QQG65FS2L2GC", "FieldLevelEncryptionProfile": { "Id": "PPK0UOSIF5WSV", "LastModifiedTime": "2019-12-10T01:03:16.537Z", "FieldLevelEncryptionProfileConfig": { "Name": "ExampleFLEProfile", "CallerReference": "cli-example", "Comment": "FLE profile for AWS CLI example", "EncryptionEntities": { "Quantity": 1, "Items": [ { "PublicKeyId": "K2K8NC4HVFE3M0", "ProviderId": "ExampleFLEProvider", "FieldPatterns": { "Quantity": 1, "Items": [ "ExampleSensitiveField" ] } } ] } } } }

Das folgende Codebeispiel zeigt, wie man. get-field-level-encryption

AWS CLI

Um eine Verschlüsselungskonfiguration auf CloudFront Feldebene zu erhalten

Im folgenden Beispiel wird die Verschlüsselungskonfiguration auf CloudFront Feldebene mit der ID C3KM2WVD605UAY abgerufen, einschließlich ihrer: ETag

aws cloudfront get-field-level-encryption --id C3KM2WVD605UAY

Ausgabe:

{ "ETag": "E2P4Z4VU7TY5SG", "FieldLevelEncryption": { "Id": "C3KM2WVD605UAY", "LastModifiedTime": "2019-12-10T21:30:18.974Z", "FieldLevelEncryptionConfig": { "CallerReference": "cli-example", "Comment": "Example FLE configuration", "QueryArgProfileConfig": { "ForwardWhenQueryArgProfileIsUnknown": true, "QueryArgProfiles": { "Quantity": 0, "Items": [] } }, "ContentTypeProfileConfig": { "ForwardWhenContentTypeIsUnknown": true, "ContentTypeProfiles": { "Quantity": 1, "Items": [ { "Format": "URLEncoded", "ProfileId": "P280MFCLSYOCVU", "ContentType": "application/x-www-form-urlencoded" } ] } } } } }

Das folgende Codebeispiel zeigt, wie man. get-invalidation-for-distribution-tenant

AWS CLI

So rufen Sie eine Invalidierung für einen Distributionsmandanten ab

Im folgenden Beispiel für get-invalidation-for-distribution-tenant werden Informationen zu einer Invalidierung für einen Distributionsmandanten abgerufen.

aws cloudfront get-invalidation-for-distribution-tenant \ --distribution-tenant-id dt_2wjDZi3hD1ivOXf6rpZJOSNE1AB \ --id I4CU23QAPKMUDUU06F9OFGFABC

Ausgabe:

{ "Invalidation": { "Id": "I4CU23QAPKMUDUU06F9OFGFABC", "Status": "Completed", "CreateTime": "2025-05-06T15:46:12.824000+00:00", "InvalidationBatch": { "Paths": { "Quantity": 2, "Items": [ "/example/invalidation", "/more/invalidations" ] }, "CallerReference": "007ee5a6-d0a0-42be-bb61-e7b915969b48" } } }

Weitere Informationen finden Sie unter Dateien für ungültig erklären, um Inhalte zu entfernen im Amazon CloudFront Developer Guide.

Das folgende Codebeispiel zeigt die Verwendung. get-invalidation

AWS CLI

Um eine CloudFront Ungültigerklärung zu erhalten

Im folgenden Beispiel wird die Invalidierung mit der ID I2J0I21PCUYOIK für die CloudFront Distribution mit der ID abgerufen: EDFDVBD6EXAMPLE

aws cloudfront get-invalidation --id I2J0I21PCUYOIK --distribution-id EDFDVBD6EXAMPLE

Ausgabe:

{ "Invalidation": { "Status": "Completed", "InvalidationBatch": { "Paths": { "Items": [ "/example-path/example-file.jpg", "/example-path/example-file-2.jpg" ], "Quantity": 2 }, "CallerReference": "cli-example" }, "Id": "I2J0I21PCUYOIK", "CreateTime": "2019-12-05T18:40:49.413Z" } }
  • Einzelheiten zur API finden Sie GetInvalidationin der AWS CLI Befehlsreferenz.

Das folgende Codebeispiel zeigt, wie man. get-managed-certificate-details

AWS CLI

So rufen Sie Details zum verwalteten Zertifikat ab

Im folgenden get-managed-certificate-details Beispiel werden die Details eines CloudFront verwalteten ACM-Zertifikats abgerufen.

aws cloudfront get-managed-certificate-details \ --identifier dt_2wjDZi3hD1ivOXf6rpZJOSNE1AB

Ausgabe:

{ "ManagedCertificateDetails": { "CertificateArn": "arn:aws:acm:us-east-1:123456789012:certificate/655dc1fe-6d37-451d-a013-c2db3a034abc", "CertificateStatus": "pending-validation", "ValidationTokenHost": "self-hosted", "ValidationTokenDetails": [ { "Domain": "example.com", "RedirectTo": "validation.us-east-1.acm-validations.aws/123456789012/.well-known/pki-validation/b315c9ae21284e7918bb9f3f422ab1c7.txt", "RedirectFrom": "example.com/.well-known/pki-validation/b315c9ae21284e7918bb9f3f422ac3c7.txt" } ] } }

Weitere Informationen finden Sie im Amazon CloudFront Developer Guide unter Zertifikate für Ihren CloudFront Distributionsmandanten anfordern.

Das folgende Codebeispiel zeigt, wie man. get-public-key-config

AWS CLI

Um eine Konfiguration mit CloudFront öffentlichen Schlüsseln zu erhalten

Im folgenden Beispiel werden Metadaten über den CloudFront öffentlichen Schlüssel mit der ID abgerufenKDFB19YGCR002, einschließlich seinerETag. Die ID des öffentlichen Schlüssels wird in der Ausgabe der Befehle „create-public-key“ und „list-public-keys“ zurückgegeben.

aws cloudfront get-public-key-config --id KDFB19YGCR002

Ausgabe:

{ "ETag": "E2QWRUHEXAMPLE", "PublicKeyConfig": { "CallerReference": "cli-example", "Name": "ExampleKey", "EncodedKey": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxPMbCA2Ks0lnd7IR+3pw\nwd3H/7jPGwj8bLUmore7bX+oeGpZ6QmLAe/1UOWcmZX2u70dYcSIzB1ofZtcn4cJ\nenHBAzO3ohBY/L1tQGJfS2A+omnN6H16VZE1JCK8XSJyfze7MDLcUyHZETdxuvRb\nA9X343/vMAuQPnhinFJ8Wdy8YBXSPpy7r95ylUQd9LfYTBzVZYG2tSesplcOkjM3\n2Uu+oMWxQAw1NINnSLPinMVsutJy6ZqlV3McWNWe4T+STGtWhrPNqJEn45sIcCx4\nq+kGZ2NQ0FyIyT2eiLKOX5Rgb/a36E/aMk4VoDsaenBQgG7WLTnstb9sr7MIhS6A\nrwIDAQAB\n-----END PUBLIC KEY-----\n", "Comment": "example public key" } }

Das folgende Codebeispiel zeigt, wie man. get-public-key

AWS CLI

Um einen CloudFront öffentlichen Schlüssel zu erhalten

Das folgende Beispiel ruft den CloudFront öffentlichen Schlüssel mit der ID abKDFB19YGCR002, einschließlich seinerETag. Die ID des öffentlichen Schlüssels wird in der Ausgabe der Befehle „create-public-key“ und „list-public-keys“ zurückgegeben.

aws cloudfront get-public-key --id KDFB19YGCR002

Ausgabe:

{ "ETag": "E2QWRUHEXAMPLE", "PublicKey": { "Id": "KDFB19YGCR002", "CreatedTime": "2019-12-05T18:51:43.781Z", "PublicKeyConfig": { "CallerReference": "cli-example", "Name": "ExampleKey", "EncodedKey": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxPMbCA2Ks0lnd7IR+3pw\nwd3H/7jPGwj8bLUmore7bX+oeGpZ6QmLAe/1UOWcmZX2u70dYcSIzB1ofZtcn4cJ\nenHBAzO3ohBY/L1tQGJfS2A+omnN6H16VZE1JCK8XSJyfze7MDLcUyHZETdxuvRb\nA9X343/vMAuQPnhinFJ8Wdy8YBXSPpy7r95ylUQd9LfYTBzVZYG2tSesplcOkjM3\n2Uu+oMWxQAw1NINnSLPinMVsutJy6ZqlV3McWNWe4T+STGtWhrPNqJEn45sIcCx4\nq+kGZ2NQ0FyIyT2eiLKOX5Rgb/a36E/aMk4VoDsaenBQgG7WLTnstb9sr7MIhS6A\nrwIDAQAB\n-----END PUBLIC KEY-----\n", "Comment": "example public key" } } }
  • Einzelheiten zur API finden Sie GetPublicKeyin der AWS CLI Befehlsreferenz.

Das folgende Codebeispiel zeigt die Verwendung. list-cloud-front-origin-access-identities

AWS CLI

Um die ursprünglichen CloudFront Zugriffsidentitäten aufzulisten

Im folgenden Beispiel wird eine Liste der CloudFront Origin-Zugriffsidentitäten (OAIs) in Ihrem Konto abgerufen: AWS

aws cloudfront list-cloud-front-origin-access-identities

Ausgabe:

{ "CloudFrontOriginAccessIdentityList": { "Items": [ { "Id": "E74FTE3AEXAMPLE", "S3CanonicalUserId": "cd13868f797c227fbea2830611a26fe0a21ba1b826ab4bed9b7771c9aEXAMPLE", "Comment": "Example OAI" }, { "Id": "EH1HDMBEXAMPLE", "S3CanonicalUserId": "1489f6f2e6faacaae7ff64c4c3e6956c24f78788abfc1718c3527c263bf7a17EXAMPLE", "Comment": "Test OAI" }, { "Id": "E2X2C9TEXAMPLE", "S3CanonicalUserId": "cbfeebb915a64749f9be546a45b3fcfd3a31c779673c13c4dd460911ae402c2EXAMPLE", "Comment": "Example OAI #2" } ] } }

Das folgende Codebeispiel zeigt, wie man es benutzt. list-connection-groups

AWS CLI

So listen Sie Verbindungsgruppen auf

Das folgende list-connection-groups Beispiel listet die verfügbaren Verbindungsgruppen in Ihrem AWS Konto auf.

aws cloudfront list-connection-groups

Ausgabe:

{ "ConnectionGroups": [ { "Id": "cg_2whCJoXMYCjHcxaLGrkllvyABC", "Name": "CreatedByCloudFront-cg_2whCJoXMYCjHcxaLGrkllvyABC", "Arn": "arn:aws:cloudfront::123456789012:connection-group/cg_2whCJoXMYCjHcxaLGrkllvyABC", "RoutingEndpoint": "d3sx0pso7m5abc.cloudfront.net", "CreatedTime": "2025-05-05T22:32:29.630000+00:00", "LastModifiedTime": "2025-05-05T22:32:29.630000+00:00", "ETag": "E23ZP02F085ABC", "Enabled": true, "Status": "Deployed", "IsDefault": true }, { "Id": "cg_2wjDWTBKTlRB87cAaUQFaakABC", "Name": "connection-group-2", "Arn": "arn:aws:cloudfront::123456789012:connection-group/cg_2wjDWTBKTlRB87cAaUQFaakABC", "RoutingEndpoint": "dvdg9gprgabc.cloudfront.net", "CreatedTime": "2025-05-06T15:42:00.790000+00:00", "LastModifiedTime": "2025-05-06T15:42:00.790000+00:00", "ETag": "E23ZP02F085ABC", "Enabled": true, "Status": "Deployed", "IsDefault": false } ] }

Weitere Informationen finden Sie unter Benutzerdefinierte Verbindungsgruppe erstellen (optional) im Amazon CloudFront Developer Guide.

Das folgende Codebeispiel zeigt die Verwendung. list-distribution-tenants-by-customization

AWS CLI

So listen Sie Distributionsmandanten nach Anpassung auf

Im folgenden Beispiel für list-distribution-tenants-by-customization werden Distributionsmandanten aufgeführt, die die angegebene Web-ACL verwenden.

aws cloudfront list-distribution-tenants-by-customization \ --web-acl-arn arn:aws:wafv2:us-east-1:123456789012:global/webacl/CreatedByCloudFront-0273cd2f/a3c19bce-42b5-48a1-a8d4-b2bb2f28eabc

Ausgabe:

{ "DistributionTenantList": [ { "Id": "dt_2wjDZi3hD1ivOXf6rpZJOSNE1AB", "DistributionId": "E1XNX8R2GOAABC", "Name": "example-tenant-2", "Arn": "arn:aws:cloudfront::123456789012:distribution-tenant/dt_2wjDZi3hD1ivOXf6rpZJOSNE1AB", "Domains": [ { "Domain": "example.com", "Status": "inactive" } ], "ConnectionGroupId": "cg_2wjDWTBKTlRB87cAaUQFaakABC", "Customizations": { "WebAcl": { "Action": "override", "Arn": "arn:aws:wafv2:us-east-1:123456789012:global/webacl/CreatedByCloudFront-0273cd2f/a3c19bce-42b5-48a1-a8d4-b2bb2f28eabc" }, "GeoRestrictions": { "RestrictionType": "whitelist", "Locations": [ "AL" ] } }, "CreatedTime": "2025-05-06T15:42:28.542000+00:00", "LastModifiedTime": "2025-05-06T16:14:08.710000+00:00", "ETag": "E1F83G8C2ARABC", "Enabled": true, "Status": "Deployed" } ] }

Weitere Informationen finden Sie unter Anpassungen für Distributions-Mandanten im Amazon CloudFront Developer Guide.

Das folgende Codebeispiel zeigt die Verwendung. list-distribution-tenants

AWS CLI

Um CloudFront Distributionsmandanten aufzulisten

Im folgenden list-distribution-tenants Beispiel werden 3 CloudFront Verteilungsmandanten in Ihrem AWS Konto nach der zugehörigen Verbindungsgruppe aufgelistet.

aws cloudfront list-distribution-tenants \ --association-filter ConnectionGroupId=cg_2whCJoXMYCjHcxaLGrkllvyABC \ --max-items 3

Ausgabe:

{ "DistributionTenantList": [ { "Id": "dt_2yMvQgam3QkJo2z54FDl91dk1AB", "DistributionId": "E1XNX8R2GOAABC", "Name": "new-tenant-customizations", "Arn": "arn:aws:cloudfront::123456789012:distribution-tenant/dt_2yMvQgam3QkJo2z54FDl91dk1AB", "Domains": [ { "Domain": "example.com", "Status": "active" } ], "ConnectionGroupId": "cg_2whCJoXMYCjHcxaLGrkllvyABC", "Customizations": { "WebAcl": { "Action": "disable" }, "GeoRestrictions": { "RestrictionType": "whitelist", "Locations": [ "DE" ] } }, "CreatedTime": "2025-06-11T15:54:02.142000+00:00", "LastModifiedTime": "2025-06-11T15:54:02.142000+00:00", "ETag": "E23ZP02F085ABC", "Enabled": false, "Status": "Deployed" }, { "Id": "dt_2yMuV7NJuBcAB0cwwxMCBZQ1AB", "DistributionId": "E1XNX8R2GOAABC", "Name": "new-tenant", "Arn": "arn:aws:cloudfront::123456789012:distribution-tenant/dt_2yMuV7NJuBcAB0cwwxMCBZQ1AB", "Domains": [ { "Domain": "1.example.com", "Status": "active" } ], "ConnectionGroupId": "cg_2whCJoXMYCjHcxaLGrkllvyABC", "Customizations": { "GeoRestrictions": { "RestrictionType": "whitelist", "Locations": [ "DE" ] } }, "CreatedTime": "2025-06-11T15:46:23.466000+00:00", "LastModifiedTime": "2025-06-11T15:46:23.466000+00:00", "ETag": "E23ZP02F085ABC", "Enabled": false, "Status": "Deployed" }, { "Id": "dt_2xVInRKCfUzQHgxosDs9hiLk1AB", "DistributionId": "E1XNX8R2GOAABC", "Name": "new-tenant-2", "Arn": "arn:aws:cloudfront::123456789012:distribution-tenant/dt_2xVInRKCfUzQHgxosDs9hiLk1AB", "Domains": [ { "Domain": "2.example.com", "Status": "active" } ], "ConnectionGroupId": "cg_2whCJoXMYCjHcxaLGrkllvyABC", "CreatedTime": "2025-05-23T16:16:20.871000+00:00", "LastModifiedTime": "2025-05-23T16:16:20.871000+00:00", "ETag": "E23ZP02F085ABC", "Enabled": false, "Status": "Deployed" } ], "NextToken": "eyJNYXJrZXIiOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAzfQ==" }

Weitere Informationen finden Sie im Amazon CloudFront Developer Guide unter Grundlegendes zur Funktionsweise von Multi-Tenant-Distributionen.

Das folgende Codebeispiel zeigt die Verwendung. list-distributions-by-connection-mode

AWS CLI

Um CloudFront Distributionen nach Verbindungsmodus aufzulisten

Das folgende list-distributions-by-connection-mode Beispiel listet CloudFront Distributionen mit dem angegebenen Verbindungsmodus auf.

aws cloudfront list-distributions-by-connection-mode \ --connection-mode tenant-only

Ausgabe:

{ "DistributionList": { "Items": [ { "Id": "E1XNX8R2GOAABC", "ARN": "arn:aws:cloudfront::123456789012:distribution/E1XNX8R2GOAABC", "ETag": "EPT4JPJQDY1ABC", "Status": "Deployed", "LastModifiedTime": "2025-05-23T16:16:15.691000+00:00", "DomainName": "-", "Aliases": { "Quantity": 0 }, "Origins": { "Quantity": 1, "Items": [ { "Id": "example-cfn-simple-distribution123", "DomainName": "example.com", "OriginPath": "", "CustomHeaders": { "Quantity": 0 }, "S3OriginConfig": { "OriginAccessIdentity": "" }, "ConnectionAttempts": 3, "ConnectionTimeout": 10, "OriginShield": { "Enabled": false }, "OriginAccessControlId": "E2CJRMB5LKEABC" } ] }, "OriginGroups": { "Quantity": 0 }, "DefaultCacheBehavior": { "TargetOriginId": "example-cfn-simple-distribution123", "TrustedKeyGroups": { "Enabled": false, "Quantity": 0 }, "ViewerProtocolPolicy": "allow-all", "AllowedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ], "CachedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ] } }, "Compress": true, "LambdaFunctionAssociations": { "Quantity": 0 }, "FunctionAssociations": { "Quantity": 0 }, "FieldLevelEncryptionId": "", "CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e5abc", "GrpcConfig": { "Enabled": false } }, "CacheBehaviors": { "Quantity": 0 }, "CustomErrorResponses": { "Quantity": 0 }, "Comment": "", "PriceClass": "PriceClass_All", "Enabled": true, "ViewerCertificate": { "CloudFrontDefaultCertificate": false, "ACMCertificateArn": "arn:aws:acm:us-east-1:123456789012:certificate/ec53f564-ea5a-4e4a-a0a2-e3c989449abc", "SSLSupportMethod": "sni-only", "MinimumProtocolVersion": "TLSv1.2_2021", "Certificate": "arn:aws:acm:us-east-1:123456789012:certificate/ec53f564-ea5a-4e4a-a0a2-e3c989449abc", "CertificateSource": "acm" }, "Restrictions": { "GeoRestriction": { "RestrictionType": "none", "Quantity": 0 } }, "WebACLId": "arn:aws:wafv2:us-east-1:123456789012:global/webacl/web-global-example/626900da-5f64-418b-ba9b-743f3746cabc", "HttpVersion": "http2", "IsIPV6Enabled": false, "Staging": false, "ConnectionMode": "tenant-only" } ] } }

Weitere Informationen finden Sie unter Benutzerdefinierte Verbindungsgruppe erstellen (optional) im Amazon CloudFront Developer Guide.

Das folgende Codebeispiel zeigt, wie man es benutzt. list-distributions

AWS CLI

Um CloudFront Distributionen aufzulisten

Im folgenden Beispiel wird eine Liste der CloudFront Verteilungen in Ihrem AWS Konto abgerufen.

aws cloudfront list-distributions

Ausgabe:

{ "DistributionList": { "Items": [ { "Id": "E23YS8OEXAMPLE", "ARN": "arn:aws:cloudfront::123456789012:distribution/E23YS8OEXAMPLE", "Status": "Deployed", "LastModifiedTime": "2024-08-05T18:23:40.375000+00:00", "DomainName": "abcdefgh12ijk.cloudfront.net", "Aliases": { "Quantity": 0 }, "Origins": { "Quantity": 1, "Items": [ { "Id": "amzn-s3-demo-bucket.s3.us-east-1.amazonaws.com", "DomainName": "amzn-s3-demo-bucket.s3.us-east-1.amazonaws.com", "OriginPath": "", "CustomHeaders": { "Quantity": 0 }, "S3OriginConfig": { "OriginAccessIdentity": "" }, "ConnectionAttempts": 3, "ConnectionTimeout": 10, "OriginShield": { "Enabled": false }, "OriginAccessControlId": "EIAP8PEXAMPLE" } ] }, "OriginGroups": { "Quantity": 0 }, "DefaultCacheBehavior": { "TargetOriginId": "amzn-s3-demo-bucket.s3.us-east-1.amazonaws.com", "TrustedSigners": { "Enabled": false, "Quantity": 0 }, "TrustedKeyGroups": { "Enabled": false, "Quantity": 0 }, "ViewerProtocolPolicy": "allow-all", "AllowedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ], "CachedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ] } }, "SmoothStreaming": false, "Compress": true, "LambdaFunctionAssociations": { "Quantity": 0 }, "FunctionAssociations": { "Quantity": 0 }, "FieldLevelEncryptionId": "", "CachePolicyId": "658327ea-f89d-4fab-a63d-7e886EXAMPLE" }, "CacheBehaviors": { "Quantity": 0 }, "CustomErrorResponses": { "Quantity": 0 }, "Comment": "", "PriceClass": "PriceClass_All", "Enabled": true, "ViewerCertificate": { "CloudFrontDefaultCertificate": true, "SSLSupportMethod": "vip", "MinimumProtocolVersion": "TLSv1", "CertificateSource": "cloudfront" }, "Restrictions": { "GeoRestriction": { "RestrictionType": "none", "Quantity": 0 } }, "WebACLId": "", "HttpVersion": "HTTP2", "IsIPV6Enabled": true, "Staging": false } ] } }

Das folgende Codebeispiel zeigt die Verwendung. list-domain-conflicts

AWS CLI

Um Domänenkonflikte für eine CloudFront Distribution aufzulisten

Das folgende list-domain-conflicts Beispiel listet Domänenkonflikte für eine CloudFront Distribution auf.

aws cloudfront list-domain-conflicts \ --domain example.com \ --domain-control-validation-resource "DistributionTenantId=dt_2x9GhoK0TZRsohWzv1b9It8J1AB"

Ausgabe:

{ "DomainConflicts": [ { "Domain": "example.com", "ResourceType": "distribution-tenant", "ResourceId": "***************ohWzv1b9It8J1AB", "AccountId": "123456789012" } ] }

Weitere Informationen finden Sie unter Verschieben eines alternativen Domainnamens in eine andere Distribution im Amazon CloudFront Developer Guide.

Das folgende Codebeispiel zeigt, wie man. list-field-level-encryption-configs

AWS CLI

Um Verschlüsselungskonfigurationen auf CloudFront Feldebene aufzulisten

Im folgenden Beispiel wird eine Liste der Verschlüsselungskonfigurationen auf CloudFront Feldebene in Ihrem Konto abgerufen: AWS

aws cloudfront list-field-level-encryption-configs

Ausgabe:

{ "FieldLevelEncryptionList": { "MaxItems": 100, "Quantity": 1, "Items": [ { "Id": "C3KM2WVD605UAY", "LastModifiedTime": "2019-12-10T21:30:18.974Z", "Comment": "Example FLE configuration", "QueryArgProfileConfig": { "ForwardWhenQueryArgProfileIsUnknown": true, "QueryArgProfiles": { "Quantity": 0, "Items": [] } }, "ContentTypeProfileConfig": { "ForwardWhenContentTypeIsUnknown": true, "ContentTypeProfiles": { "Quantity": 1, "Items": [ { "Format": "URLEncoded", "ProfileId": "P280MFCLSYOCVU", "ContentType": "application/x-www-form-urlencoded" } ] } } } ] } }

Das folgende Codebeispiel zeigt die Verwendung. list-field-level-encryption-profiles

AWS CLI

Um Verschlüsselungsprofile auf CloudFront Feldebene aufzulisten

Im folgenden Beispiel wird eine Liste der Verschlüsselungsprofile auf CloudFront Feldebene in Ihrem Konto abgerufen: AWS

aws cloudfront list-field-level-encryption-profiles

Ausgabe:

{ "FieldLevelEncryptionProfileList": { "MaxItems": 100, "Quantity": 2, "Items": [ { "Id": "P280MFCLSYOCVU", "LastModifiedTime": "2019-12-05T01:05:39.896Z", "Name": "ExampleFLEProfile", "EncryptionEntities": { "Quantity": 1, "Items": [ { "PublicKeyId": "K2K8NC4HVFE3M0", "ProviderId": "ExampleFLEProvider", "FieldPatterns": { "Quantity": 1, "Items": [ "ExampleSensitiveField" ] } } ] }, "Comment": "FLE profile for AWS CLI example" }, { "Id": "PPK0UOSIF5WSV", "LastModifiedTime": "2019-12-10T01:03:16.537Z", "Name": "ExampleFLEProfile2", "EncryptionEntities": { "Quantity": 1, "Items": [ { "PublicKeyId": "K2ABC10EXAMPLE", "ProviderId": "ExampleFLEProvider2", "FieldPatterns": { "Quantity": 1, "Items": [ "ExampleSensitiveField2" ] } } ] }, "Comment": "FLE profile #2 for AWS CLI example" } ] } }

Das folgende Codebeispiel zeigt die Verwendung. list-invalidations-for-distribution-tenant

AWS CLI

Um Ungültigkeiten für einen CloudFront Distributionsmandanten aufzulisten

Im folgenden list-invalidations-for-distribution-tenant Beispiel werden die Ungültigerklärungen für einen Verteilungsmandanten aufgeführt. CloudFront

aws cloudfront list-invalidations-for-distribution-tenant \ --id dt_2wjDZi3hD1ivOXf6rpZJOSNE1AB

Ausgabe:

{ "InvalidationList": { "Items": [ { "Id": "I4CU23QAPKMUDUU06F9OFGFABC", "CreateTime": "2025-05-06T15:46:12.824000+00:00", "Status": "Completed" } ] } }

Weitere Informationen finden Sie unter Dateien für ungültig erklären, um Inhalte zu entfernen im Amazon CloudFront Developer Guide.

Das folgende Codebeispiel zeigt, wie man es benutzt. list-invalidations

AWS CLI

Um CloudFront Ungültigkeiten aufzulisten

Im folgenden Beispiel wird eine Liste der Ungültigerklärungen für die CloudFront Distribution mit der ID abgerufen: EDFDVBD6EXAMPLE

aws cloudfront list-invalidations --distribution-id EDFDVBD6EXAMPLE

Ausgabe:

{ "InvalidationList": { "Marker": "", "Items": [ { "Status": "Completed", "Id": "YNY2LI2BVJ4NJU", "CreateTime": "2019-08-31T21:15:52.042Z" } ], "IsTruncated": false, "MaxItems": 100, "Quantity": 1 } }

Das folgende Codebeispiel zeigt, wie man es benutzt. list-public-keys

AWS CLI

Um CloudFront öffentliche Schlüssel aufzulisten

Im folgenden Beispiel wird eine Liste der CloudFront öffentlichen Schlüssel in Ihrem AWS Konto abgerufen:

aws cloudfront list-public-keys

Ausgabe:

{ "PublicKeyList": { "MaxItems": 100, "Quantity": 2, "Items": [ { "Id": "K2K8NC4HVFE3M0", "Name": "ExampleKey", "CreatedTime": "2019-12-05T01:04:28.818Z", "EncodedKey": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxPMbCA2Ks0lnd7IR+3pw\nwd3H/7jPGwj8bLUmore7bX+oeGpZ6QmLAe/1UOWcmZX2u70dYcSIzB1ofZtcn4cJ\nenHBAzO3ohBY/L1tQGJfS2A+omnN6H16VZE1JCK8XSJyfze7MDLcUyHZETdxuvRb\nA9X343/vMAuQPnhinFJ8Wdy8YBXSPpy7r95ylUQd9LfYTBzVZYG2tSesplcOkjM3\n2Uu+oMWxQAw1NINnSLPinMVsutJy6ZqlV3McWNWe4T+STGtWhrPNqJEn45sIcCx4\nq+kGZ2NQ0FyIyT2eiLKOX5Rgb/a36E/aMk4VoDsaenBQgG7WLTnstb9sr7MIhS6A\nrwIDAQAB\n-----END PUBLIC KEY-----\n", "Comment": "example public key" }, { "Id": "K1S0LWQ2L5HTBU", "Name": "ExampleKey2", "CreatedTime": "2019-12-09T23:28:11.110Z", "EncodedKey": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApOCAg88A8+f4dujn9Izt\n26LxtgAkn2opGgo/NKpMiaisyw5qlg3f1gol7FV6pYNl78iJg3EO8JBbwtlH+cR9\nLGSf60NDeVhm76Oc39Np/vWgOdsGQcRbi9WmKZeSODqjQGzVZWqPmito3FzWVk6b\nfVY5N36U/RdbVAJm95Km+qaMYlbIdF40t72bi3IkKYV5hlB2XoDjlQ9F6ajQKyTB\nMHa3SN8q+3ZjQ4sJJ7D1V6r4wR8jDcFVD5NckWJmmgIVnkOQM37NYeoDnkaOuTpu\nha/+3b8tOb2z3LBVHPkp85zJRAOXacSwf5rZtPYKBNFsixTa2n55k2r218mOkMC4\nUwIDAQAB\n-----END PUBLIC KEY-----", "Comment": "example public key #2" } ] } }
  • Einzelheiten zur API finden Sie ListPublicKeysin der AWS CLI Befehlsreferenz.

Das folgende Codebeispiel zeigt die Verwendunglist-tags-for-resource.

AWS CLI

Um Tags für eine CloudFront Distribution aufzulisten

Im folgenden Beispiel wird eine Liste der Tags für eine CloudFront Distribution abgerufen:

aws cloudfront list-tags-for-resource \ --resource arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE

Ausgabe:

{ "Tags": { "Items": [ { "Key": "DateCreated", "Value": "2019-12-04" }, { "Key": "Name", "Value": "Example name" }, { "Key": "Project", "Value": "Example project" } ] } }

Das folgende Codebeispiel zeigt die Verwendungsign.

AWS CLI

Um eine CloudFront URL zu signieren

Das folgende Beispiel signiert eine CloudFront URL. Um eine URL zu signieren, benötigen Sie die Schlüsselpaar-ID (in der AWS Management Console als Access Key-ID bezeichnet) und den privaten Schlüssel des CloudFront key pair des vertrauenswürdigen Unterzeichners. Weitere Informationen zu signierten URLs finden Sie unter Bereitstellung privater Inhalte mit signierten URLs und signierten Cookies im Amazon CloudFront Developer Guide.

aws cloudfront sign \ --url https://d111111abcdef8.cloudfront.net/private-content/private-file.html \ --key-pair-id APKAEIBAERJR2EXAMPLE \ --private-key file://cf-signer-priv-key.pem \ --date-less-than 2020-01-01

Ausgabe:

https://d111111abcdef8.cloudfront.net/private-content/private-file.html?Expires=1577836800&Signature=nEXK7Kby47XKeZQKVc6pwkif6oZc-JWSpDkH0UH7EBGGqvgurkecCbgL5VfUAXyLQuJxFwRQWscz-owcq9KpmewCXrXQbPaJZNi9XSNwf4YKurPDQYaRQawKoeenH0GFteRf9ELK-Bs3nljTLjtbgzIUt7QJNKXcWr8AuUYikzGdJ4-qzx6WnxXfH~fxg4-GGl6l2kgCpXUB6Jx6K~Y3kpVOdzUPOIqFLHAnJojbhxqrVejomZZ2XrquDvNUCCIbePGnR3d24UPaLXG4FKOqNEaWDIBXu7jUUPwOyQCvpt-GNvjRJxqWf93uMobeMOiVYahb-e0KItiQewGcm0eLZQ__&Key-Pair-Id=APKAEIBAERJR2EXAMPLE
  • Weitere API-Informationen finden Sie unter Sign in der AWS CLI -Befehlsreferenz.

Das folgende Codebeispiel zeigt die Verwendung vontag-resource.

AWS CLI

Um eine CloudFront Distribution zu taggen

Im folgenden tag-resource Beispiel werden der angegebenen CloudFront Verteilung zwei Tags hinzugefügt.

aws cloudfront tag-resource \ --resource arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE \ --tags 'Items=[{Key=Name,Value="Example name"},{Key=Project,Value="Example project"}]'

Statt Befehlszeilenargumente zu verwenden, können Sie die Tags in einer JSON-Datei angeben, wie im folgenden Beispiel gezeigt:

aws cloudfront tag-resource \ --resource arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE \ --tags file://tags.json

Inhalt von tags.json:

{ "Items": [ { "Key": "Name", "Value": "Example name" }, { "Key": "Project", "Value": "Example project" } ] }

Mit diesem Befehl wird keine Ausgabe zurückgegeben.

  • Einzelheiten zur API finden Sie TagResourcein der AWS CLI Befehlsreferenz.

Das folgende Codebeispiel zeigt die Verwendunguntag-resource.

AWS CLI

Um Tags aus einer CloudFront Distribution zu entfernen

Im folgenden Beispiel werden mithilfe von Befehlszeilenargumenten zwei Tags aus einer CloudFront Distribution entfernt:

aws cloudfront untag-resource \ --resource arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE \ --tag-keys Items=Name,Project

Statt Befehlszeilenargumente zu verwenden, können Sie die Tag-Schlüssel in einer JSON-Datei angeben, wie im folgenden Beispiel gezeigt:

aws cloudfront untag-resource \ --resource arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE \ --tag-keys file://tag-keys.json

Die Datei tag-keys.json ist ein JSON-Dokument im aktuellen Verzeichnis, das Folgendes enthält:

{ "Items": [ "Name", "Project" ] }

Bei erfolgreicher Ausführung gibt dieser Befehl keine Ausgabe aus.

  • Einzelheiten zur API finden Sie UntagResourceunter AWS CLI Befehlsreferenz.

Das folgende Codebeispiel zeigt die Verwendung. update-cloud-front-origin-access-identity

AWS CLI

Um eine CloudFront ursprüngliche Zugriffsidentität zu aktualisieren

Im folgenden Beispiel wird die Ursprungszugriffsidentität (OAI) mit der ID E74FTE3AEXAMPLE aktualisiert. Das einzige Feld, das Sie aktualisieren können, ist das Feld Comment der OAI.

Um eine OAI zu aktualisieren, benötigen Sie die ID und das ETag der OAI. Die OAI-ID wird in der Ausgabe der Befehle create-cloud-front-origin-access-identity und list-cloud-front-origin-access-identities zurückgegeben. Verwenden Sie den Befehl get-cloud-front-origin-access-identity oder get-cloud-front-origin-access-identity-config, um das ETag abzurufen. Verwenden Sie die Option --if-match, um das OAI-ETag bereitzustellen.

aws cloudfront update-cloud-front-origin-access-identity \ --id E74FTE3AEXAMPLE \ --if-match E2QWRUHEXAMPLE \ --cloud-front-origin-access-identity-config \ CallerReference=cli-example,Comment="Example OAI Updated"

Sie können dasselbe erreichen, indem Sie die OAI-Konfiguration in einer JSON-Datei bereitstellen, wie im folgenden Beispiel gezeigt:

aws cloudfront update-cloud-front-origin-access-identity \ --id E74FTE3AEXAMPLE \ --if-match E2QWRUHEXAMPLE \ --cloud-front-origin-access-identity-config file://OAI-config.json

Die Datei OAI-config.json ist ein JSON-Dokument im aktuellen Verzeichnis, das Folgendes enthält:

{ "CallerReference": "cli-example", "Comment": "Example OAI Updated" }

Unabhängig davon, ob Sie die OAI-Konfiguration mit einem Befehlszeilenargument oder einer JSON-Datei angeben, ist die Ausgabe identisch:

{ "ETag": "E9LHASXEXAMPLE", "CloudFrontOriginAccessIdentity": { "Id": "E74FTE3AEXAMPLE", "S3CanonicalUserId": "cd13868f797c227fbea2830611a26fe0a21ba1b826ab4bed9b7771c9aEXAMPLE", "CloudFrontOriginAccessIdentityConfig": { "CallerReference": "cli-example", "Comment": "Example OAI Updated" } } }

Das folgende Codebeispiel zeigt, wie man es benutzt. update-connection-group

AWS CLI

Um eine CloudFront Verbindungsgruppe zu aktualisieren

Das folgende update-connection-group Beispiel deaktiviert eine CloudFront Verbindungsgruppe und deaktiviert IPv6.

aws cloudfront update-connection-group \ --id cg_2yHsDkcPKeUlVkk3aEgLKcjABC \ --no-ipv6-enabled \ --no-enabled \ --if-match E3UN6WX5RRO2ABC

Ausgabe:

{ "ETag": "E1F83G8C2ARABC", "ConnectionGroup": { "Id": "cg_2yHsDkcPKeUlVkk3aEgLKcjABC", "Name": "cg-example", "Arn": "arn:aws:cloudfront::123456789012:connection-group/cg_2yHsDkcPKeUlVkk3aEgLKcjABC", "CreatedTime": "2025-06-09T20:58:35.481000+00:00", "LastModifiedTime": "2025-06-11T16:25:54.280000+00:00", "Ipv6Enabled": false, "RoutingEndpoint": "du9xp1elo1abc.cloudfront.net", "Status": "InProgress", "Enabled": false, "IsDefault": false } }

Weitere Informationen finden Sie unter Benutzerdefinierte Verbindungsgruppe erstellen (optional) im Amazon CloudFront Developer Guide.

Das folgende Codebeispiel zeigt, wie man es benutzt. update-distribution-tenant

AWS CLI

Um einen CloudFront Distributionsmandanten zu aktualisieren

Im folgenden update-distribution-tenant Beispiel wird ein CloudFront Distributionsmandant mit einem neuen Parameterwert aktualisiert und den Geoeinschränkungen ein Land hinzugefügt.

aws cloudfront update-distribution-tenant \ --cli-input-json file://update-tenant.json

Inhalt von update-tenant.json:

{ "Id": "dt_2yMvQgam3QkJo2z54FDl91dk1AB", "IfMatch": "E1F83G8C2ARABC", "Parameters": [ { "Name": "testParam", "Value": "newParameterValue" } ], "Customizations": { "WebAcl": { "Action": "disable" }, "GeoRestrictions": { "RestrictionType": "whitelist", "Locations": [ "DE", "GB", "ES" ] } } }

Ausgabe:

{ "ETag": "E1PA6795UKMABC", "DistributionTenant": { "Id": "dt_2yMvQgam3QkJo2z54FDl91dk1AB", "DistributionId": "E1XNX8R2GOAABC", "Name": "new-tenant-customizations", "Arn": "arn:aws:cloudfront::123456789012:distribution-tenant/dt_2yMvQgam3QkJo2z54FDl91dk1AB", "Domains": [ { "Domain": "example.com", "Status": "active" } ], "Customizations": { "WebAcl": { "Action": "disable" }, "GeoRestrictions": { "RestrictionType": "whitelist", "Locations": [ "DE", "ES", "GB" ] } }, "Parameters": [ { "Name": "testParam", "Value": "newParameterValue" } ], "ConnectionGroupId": "cg_2whCJoXMYCjHcxaLGrkllvyABC", "CreatedTime": "2025-06-11T15:54:02.142000+00:00", "LastModifiedTime": "2025-06-11T16:42:45.531000+00:00", "Enabled": false, "Status": "InProgress" } }

Weitere Informationen finden Sie unter Anpassungen für Distributions-Mandanten im Amazon CloudFront Developer Guide.

Das folgende Codebeispiel zeigt, wie man es benutzt. update-distribution

AWS CLI

Beispiel 1: Um das Standard-Root-Objekt einer CloudFront Distribution zu aktualisieren

Im folgenden Beispiel wird das Standard-Stammobjekt index.html für die CloudFront Distribution mit der ID aktualisiertEDFDVBD6EXAMPLE.

aws cloudfront update-distribution \ --id EDFDVBD6EXAMPLE \ --default-root-object index.html

Ausgabe:

{ "ETag": "E2QWRUHEXAMPLE", "Distribution": { "Id": "EDFDVBD6EXAMPLE", "ARN": "arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE", "Status": "InProgress", "LastModifiedTime": "2019-12-06T18:55:39.870Z", "InProgressInvalidationBatches": 0, "DomainName": "d111111abcdef8.cloudfront.net", "ActiveTrustedSigners": { "Enabled": false, "Quantity": 0 }, "DistributionConfig": { "CallerReference": "6b10378d-49be-4c4b-a642-419ccaf8f3b5", "Aliases": { "Quantity": 0 }, "DefaultRootObject": "index.html", "Origins": { "Quantity": 1, "Items": [ { "Id": "example-website", "DomainName": "www.example.com", "OriginPath": "", "CustomHeaders": { "Quantity": 0 }, "CustomOriginConfig": { "HTTPPort": 80, "HTTPSPort": 443, "OriginProtocolPolicy": "match-viewer", "OriginSslProtocols": { "Quantity": 2, "Items": [ "SSLv3", "TLSv1" ] }, "OriginReadTimeout": 30, "OriginKeepaliveTimeout": 5 } } ] }, "OriginGroups": { "Quantity": 0 }, "DefaultCacheBehavior": { "TargetOriginId": "example-website", "ForwardedValues": { "QueryString": false, "Cookies": { "Forward": "none" }, "Headers": { "Quantity": 1, "Items": [ "*" ] }, "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": "http1.1", "IsIPV6Enabled": true } } }

Beispiel 2: Um eine CloudFront Distribution zu aktualisieren

Im folgenden Beispiel wird die CloudFront Distribution mit der ID deaktiviert, EMLARXS9EXAMPLE indem die Verteilungskonfiguration in einer JSON-Datei mit dem Namen dist-config-disable.json bereitgestellt wird. Um eine Distribution zu aktualisieren, müssen Sie die Option --if-match verwenden, um das ETag der Distribution anzugeben. Um den ETag zu erhalten, verwenden Sie bitte den Befehl „get-Distribution“ oder „get-Distribution-Config“. Beachten Sie, dass das Feld Enabled in der JSON-Datei auf false gesetzt ist.

Nachdem Sie das folgende Beispiel verwendet haben, um die Distribution zu deaktivieren, können Sie den Befehl „delete-distribution“ verwenden, um sie zu löschen.

aws cloudfront update-distribution \ --id EMLARXS9EXAMPLE \ --if-match E2QWRUHEXAMPLE \ --distribution-config file://dist-config-disable.json

Inhalt von dist-config-disable.json:

{ "CallerReference": "cli-1574382155-496510", "Aliases": { "Quantity": 0 }, "DefaultRootObject": "index.html", "Origins": { "Quantity": 1, "Items": [ { "Id": "amzn-s3-demo-bucket.s3.amazonaws.com-1574382155-273939", "DomainName": "amzn-s3-demo-bucket.s3.amazonaws.com", "OriginPath": "", "CustomHeaders": { "Quantity": 0 }, "S3OriginConfig": { "OriginAccessIdentity": "" } } ] }, "OriginGroups": { "Quantity": 0 }, "DefaultCacheBehavior": { "TargetOriginId": "amzn-s3-demo-bucket.s3.amazonaws.com-1574382155-273939", "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": false, "ViewerCertificate": { "CloudFrontDefaultCertificate": true, "MinimumProtocolVersion": "TLSv1", "CertificateSource": "cloudfront" }, "Restrictions": { "GeoRestriction": { "RestrictionType": "none", "Quantity": 0 } }, "WebACLId": "", "HttpVersion": "http2", "IsIPV6Enabled": true }

Ausgabe:

{ "ETag": "E9LHASXEXAMPLE", "Distribution": { "Id": "EMLARXS9EXAMPLE", "ARN": "arn:aws:cloudfront::123456789012:distribution/EMLARXS9EXAMPLE", "Status": "InProgress", "LastModifiedTime": "2019-12-06T18:32:35.553Z", "InProgressInvalidationBatches": 0, "DomainName": "d111111abcdef8.cloudfront.net", "ActiveTrustedSigners": { "Enabled": false, "Quantity": 0 }, "DistributionConfig": { "CallerReference": "cli-1574382155-496510", "Aliases": { "Quantity": 0 }, "DefaultRootObject": "index.html", "Origins": { "Quantity": 1, "Items": [ { "Id": "amzn-s3-demo-bucket.s3.amazonaws.com-1574382155-273939", "DomainName": "amzn-s3-demo-bucket.s3.amazonaws.com", "OriginPath": "", "CustomHeaders": { "Quantity": 0 }, "S3OriginConfig": { "OriginAccessIdentity": "" } } ] }, "OriginGroups": { "Quantity": 0 }, "DefaultCacheBehavior": { "TargetOriginId": "amzn-s3-demo-bucket.s3.amazonaws.com-1574382155-273939", "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": false, "ViewerCertificate": { "CloudFrontDefaultCertificate": true, "MinimumProtocolVersion": "TLSv1", "CertificateSource": "cloudfront" }, "Restrictions": { "GeoRestriction": { "RestrictionType": "none", "Quantity": 0 } }, "WebACLId": "", "HttpVersion": "http2", "IsIPV6Enabled": true } } }

Das folgende Codebeispiel zeigt, wie man es benutzt. update-domain-association

AWS CLI

So aktualisieren Sie eine Domainzuordnung

Im folgenden Beispiel für update-domain-association wird eine Domainzuordnung für einen Distributionsmandanten mit dem ETag E23ZP02F085ABC aktualisiert.

aws cloudfront update-domain-association \ --domain example.com \ --target-resource DistributionTenantId=dt_2x9GhoK0TZRsohWzv1b9It8J1AB \ --if-match E23ZP02F085ABC

Ausgabe:

{ "ETag": "ETVPDKIKX0ABC", "Domain": "example.com", "ResourceId": "dt_2x9GhoK0TZRsohWzv1b9It8J1AB" }

Weitere Informationen finden Sie unter Verschieben eines alternativen Domainnamens in eine andere Distribution im Amazon CloudFront Developer Guide.

Das folgende Codebeispiel zeigt, wie man. update-field-level-encryption-config

AWS CLI

Um eine Verschlüsselungskonfiguration auf CloudFront Feldebene zu aktualisieren

Im folgenden Beispiel wird das Feld Comment der Verschlüsselungskonfiguration auf Feldebene mit der ID C3KM2WVD605UAY aktualisiert, indem die Parameter in einer JSON-Datei bereitgestellt werden.

Um eine Verschlüsselungskonfiguration auf Feldebene zu aktualisieren, benötigen Sie die ID und das ETag der Konfiguration. Die ID wird in der Ausgabe der Befehle „create-field-level-encryption-config“ und „list-field-level-encryption-configs“ zurückgegeben. Verwenden Sie den Befehl „get-field-level-encryption“ oder „get-field-level-encryption-config“, um das ETag abzurufen. Verwenden Sie die Option --if-match, um das ETag der Konfiguration bereitzustellen.

aws cloudfront update-field-level-encryption-config \ --id C3KM2WVD605UAY \ --if-match E2P4Z4VU7TY5SG \ --field-level-encryption-config file://fle-config.json

Die Datei fle-config.json ist ein JSON-Dokument im aktuellen Verzeichnis, das Folgendes enthält:

{ "CallerReference": "cli-example", "Comment": "Updated example FLE configuration", "QueryArgProfileConfig": { "ForwardWhenQueryArgProfileIsUnknown": true, "QueryArgProfiles": { "Quantity": 0 } }, "ContentTypeProfileConfig": { "ForwardWhenContentTypeIsUnknown": true, "ContentTypeProfiles": { "Quantity": 1, "Items": [ { "Format": "URLEncoded", "ProfileId": "P280MFCLSYOCVU", "ContentType": "application/x-www-form-urlencoded" } ] } } }

Ausgabe:

{ "ETag": "E26M4BIAV81ZF6", "FieldLevelEncryption": { "Id": "C3KM2WVD605UAY", "LastModifiedTime": "2019-12-10T22:26:26.170Z", "FieldLevelEncryptionConfig": { "CallerReference": "cli-example", "Comment": "Updated example FLE configuration", "QueryArgProfileConfig": { "ForwardWhenQueryArgProfileIsUnknown": true, "QueryArgProfiles": { "Quantity": 0, "Items": [] } }, "ContentTypeProfileConfig": { "ForwardWhenContentTypeIsUnknown": true, "ContentTypeProfiles": { "Quantity": 1, "Items": [ { "Format": "URLEncoded", "ProfileId": "P280MFCLSYOCVU", "ContentType": "application/x-www-form-urlencoded" } ] } } } } }

Das folgende Codebeispiel zeigt die Verwendung. update-field-level-encryption-profile

AWS CLI

Um ein Verschlüsselungsprofil auf CloudFront Feldebene zu aktualisieren

Im folgenden Beispiel wird das Verschlüsselungsprofil auf Feldebene mit der ID PPK0UOSIF5WSV aktualisiert. In diesem Beispiel werden die Parameter Name und Comment des Profils aktualisiert und ein zweites FieldPatterns-Element wird hinzugefügt, indem die Parameter in einer JSON-Datei bereitgestellt werden.

Um ein Verschlüsselungsprofil auf Feldebene zu aktualisieren, benötigen Sie die ID und das ETag des Profils. Die ID wird in der Ausgabe der Befehle „create-field-level-encryption-profile“ und „list-field-level-encryption-profiles“ zurückgegeben. Verwenden Sie den Befehl „get-field-level-encryption-profile“ oder „get-field-level-encryption-profile-config“, um das ETag abzurufen. Verwenden Sie die Option --if-match, um das ETag des Profils bereitzustellen.

aws cloudfront update-field-level-encryption-profile \ --id PPK0UOSIF5WSV \ --if-match E1QQG65FS2L2GC \ --field-level-encryption-profile-config file://fle-profile-config.json

Die Datei fle-profile-config.json ist ein JSON-Dokument im aktuellen Verzeichnis, das Folgendes enthält:

{ "Name": "ExampleFLEProfileUpdated", "CallerReference": "cli-example", "Comment": "Updated FLE profile for AWS CLI example", "EncryptionEntities": { "Quantity": 1, "Items": [ { "PublicKeyId": "K2K8NC4HVFE3M0", "ProviderId": "ExampleFLEProvider", "FieldPatterns": { "Quantity": 2, "Items": [ "ExampleSensitiveField", "SecondExampleSensitiveField" ] } } ] } }

Ausgabe:

{ "ETag": "EJETYFJ9CL66D", "FieldLevelEncryptionProfile": { "Id": "PPK0UOSIF5WSV", "LastModifiedTime": "2019-12-10T19:05:58.296Z", "FieldLevelEncryptionProfileConfig": { "Name": "ExampleFLEProfileUpdated", "CallerReference": "cli-example", "Comment": "Updated FLE profile for AWS CLI example", "EncryptionEntities": { "Quantity": 1, "Items": [ { "PublicKeyId": "K2K8NC4HVFE3M0", "ProviderId": "ExampleFLEProvider", "FieldPatterns": { "Quantity": 2, "Items": [ "ExampleSensitiveField", "SecondExampleSensitiveField" ] } } ] } } } }

Das folgende Codebeispiel zeigt die Verwendung. verify-dns-configuration

AWS CLI

So überprüfen Sie die DNS-Konfiguration für eine Domain

Im folgenden Beispiel für verify-dns-configuration wird die DNS-Konfiguration für eine Domain überprüft.

aws cloudfront verify-dns-configuration \ --domain example.com \ --identifier dt_2x9GhoK0TZRsohWzv1b9It8J1AB

Ausgabe:

{ "DnsConfigurationList": [ { "Domain": "example.com", "Status": "valid-configuration" } ] }

Weitere Informationen finden Sie unter Verschieben eines alternativen Domainnamens in eine andere Distribution im Amazon CloudFront Developer Guide.