Esempi per CloudFront con AWS CLI
Gli esempi di codice seguenti mostrano come eseguire azioni e implementare scenari comuni utilizzando AWS Command Line Interface con CloudFront.
Le operazioni sono estratti di codice da programmi più grandi e devono essere eseguite nel contesto. Sebbene le operazioni mostrino come richiamare le singole funzioni del servizio, è possibile visualizzarle contestualizzate negli scenari correlati.
Ogni esempio include un link al codice sorgente completo, dove è possibile trovare le istruzioni su come configurare ed eseguire il codice nel contesto.
Argomenti
Operazioni
L’esempio di codice seguente mostra come utilizzare associate-distribution-tenant-web-acl.
- AWS CLI
-
Come associare una lista di controllo degli accessi (ACL) web a un tenant di distribuzione CloudFront
Nell’esempio seguente
associate-distribution-tenant-web-aclassocia una lista di controllo degli accessi (ACL) web con una distribuzione CloudFront con ETagE13V1IB3VIYABC.aws cloudfront associate-distribution-tenant-web-acl \ --iddt_2wjDZi3hD1ivOXf6rpZJO1AB\ --if-matchE13V1IB3VIYABC\ --web-acl-arnarn:aws:wafv2:us-east-1:123456789012:global/webacl/web-global-example/626900da-5f64-418b-ba9b-743f37123ABCOutput:
{ "ETag": "E1VC38T7YXBABC", "Id": "dt_2wjDZi3hD1ivOXf6rpZJO1AB", "WebACLArn": "arn:aws:wafv2:us-east-1:123456789012:global/webacl/web-global-example/626900da-5f64-418b-ba9b-743f37123ABC" }Per ulteriori informazioni, consulta Use AWS WAF protections nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta AssociateDistributionTenantWebAcl
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare associate-distribution-web-acl.
- AWS CLI
-
Come associare una lista di controllo degli accessi (ACL) web a una distribuzione CloudFront
Nell’esempio seguente
associate-distribution-web-aclassocia una lista di controllo degli accessi (ACL) web a una distribuzione CloudFront.aws cloudfront associate-distribution-web-acl \ --idE1XNX8R2GOAABC\ --if-matchE2YWS1C2J3OABC\ --web-acl-arnarn:aws:wafv2:us-east-1:123456789012:global/webacl/web-global-example/626900da-5f64-418b-ba9b-743f3746cABCOutput:
{ "ETag": "E3QE7ED60U0ABC", "Id": "E1XNX8R2GOAABC", "WebACLArn": "arn:aws:wafv2:us-east-1:123456789012:global/webacl/web-global-example/626900da-5f64-418b-ba9b-743f3746cABC" }Per ulteriori informazioni, consulta Use AWS WAF protections nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta AssociateDistributionWebAcl
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare create-cloud-front-origin-access-identity.
- AWS CLI
-
Come creare un’identità di accesso origine di CloudFront
L’esempio seguente crea un’identità di accesso origine (OAI) CloudFront fornendo la configurazione OAI come argomento della riga di comando:
aws cloudfront create-cloud-front-origin-access-identity \ --cloud-front-origin-access-identity-config \ CallerReference="cli-example",Comment="Example OAI"È possibile ottenere lo stesso risultato indicando la configurazione OAI in un file JSON, come mostrato nell’esempio seguente:
aws cloudfront create-cloud-front-origin-access-identity \ --cloud-front-origin-access-identity-configfile://OAI-config.jsonIl file
OAI-config.jsonè un documento JSON nella directory corrente che contiene quanto segue:{ "CallerReference": "cli-example", "Comment": "Example OAI" }Sia che si fornisca la configurazione OAI con un argomento della riga di comando o con un file JSON, l’output è lo stesso:
{ "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" } } }-
Per informazioni dettagliate sull’API, consulta CreateCloudFrontOriginAccessIdentity
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare create-connection-group.
- AWS CLI
-
Come creare un gruppo di connessioni in CloudFront
L’esempio
create-connection-groupseguente crea un gruppo di connessioni abilitato, specifica un elenco di IP statici Anycast e disabilita IPv6.aws cloudfront create-connection-group \ --namecg-with-anycast-ip-list\ --no-ipv6-enabled \ --enabled \ --anycast-ip-list-idaip_CCkW6gKrDiBD4n78123ABC\ --tags"Items=[{Key=abc,Value=123}]"Output:
{ "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 } }Per ulteriori informazioni, consulta Create custom connection group (optional) nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta CreateConnectionGroup
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare create-distribution-tenant.
- AWS CLI
-
Esempio 1: creare un tenant di distribuzione CloudFront che utilizza un certificato personalizzato
L’esempio
create-distribution-tenantseguente crea un tenant di distribuzione CloudFront che specifica personalizzazioni per disabilitare WAF, aggiungere restrizioni geografiche e utilizzare un altro certificato TLS.aws cloudfront create-distribution-tenant \ --cli-input-jsonfile://tenant.jsonContenuto di
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" } } }Output:
{ "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" } }Esempio 2: creare un tenant di distribuzione con un certificato ereditato
L’esempio
create-distribution-tenantseguente crea un tenant di distribuzione e specifica un certificato TLS ereditato dalla distribuzione multi-tenant.aws cloudfront create-distribution-tenant \ --cli-input-jsonfile://tenant.jsonContenuto di
tenant.json.{ "DistributionId": "E1HVIAU7U12ABC", "Domains": [ { "Domain": "example.com" } ], "Parameters": [ { "Name": "tenantName", "Value": "first-tenant" } ], "Enabled": true, "Name": "new-tenant-no-cert" }Output:
{ "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" } }Esempio 3: creare un tenant di distribuzione CloudFront utilizzando un token di convalida ospitato in CloudFront
L’esempio
create-distribution-tenantseguente crea un tenant di distribuzione e utilizza un token di convalida ospitato su CloudFront per il nome di dominio.aws cloudfront create-distribution-tenant \ --cli-input-jsonfile://tenant.jsonContenuto di
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" } }Importante: per eseguire correttamente questo comando, è necessario configurare un record DNS CNAME che indirizzi il nuovo dominio (example.com) all’endpoint di routing del gruppo di connessione associato al tenant di distribuzione. Il record CNAME deve anche essere propagato prima che CloudFront possa completare la richiesta.
Output:
{ "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" } }Esempio 4: creare un tenant di distribuzione CloudFront utilizzando un token di convalida ospitato autonomamente
L’esempio
create-distribution-tenantseguente crea un tenant di distribuzione CloudFront e utilizza un token di convalida ospitato autonomamente.aws cloudfront create-distribution-tenant \ --cli-input-jsonfile://tenant.jsonContenuto di
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" } }Output:
{ "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" } }Importante: dopo l’esecuzione di questo comando, il tenant di distribuzione viene creato senza convalida. Per convalidare la richiesta di certificato gestito e configurare il DNS quando si può iniziare a ricevere traffico, consulta Complete domain setup nella Guida per gli sviluppatori di Amazon CloudFront.
Per ulteriori informazioni sulla creazione di tenant di distribuzione, consulta Creazione di una distribuzione nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta CreateDistributionTenant
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare create-distribution-with-tags.
- AWS CLI
-
Come creare una distribuzione CloudFront con tag
L’esempio
create-distribution-with-tagsseguente crea una distribuzione con due tag fornendo la configurazione di distribuzione e i tag in un file JSON denominatodist-config-with-tags.json.aws cloudfront create-distribution-with-tags \ --distribution-config-with-tagsfile://dist-config-with-tags.jsonIl file
dist-config-with-tags.jsonè un documento JSON nella cartella corrente. Nota l’oggettoTagsnella parte superiore del file, che contiene due tag:Name = ExampleDistributionProject = ExampleProjectContenuto di
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.rproxy.govskope.ca-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.rproxy.govskope.ca-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 } }Output:
{ "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.rproxy.govskope.ca-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.rproxy.govskope.ca-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 } } }-
Per informazioni dettagliate sull’API, consulta CreateDistributionWithTags
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare create-distribution.
- AWS CLI
-
Esempio 1: creare una distribuzione CloudFront
L’esempio
create-distributionseguente crea una distribuzione per un bucket S3 denominatoamzn-s3-demo-buckete specifica ancheindex.htmlcome oggetto root predefinito, utilizzando argomenti della riga di comando.aws cloudfront create-distribution \ --origin-domain-nameamzn-s3-demo-bucket.s3.amazonaws.com\ --default-root-objectindex.htmlOutput:
{ "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.rproxy.govskope.ca-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.rproxy.govskope.ca-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 } } }Esempio 2: creare una distribuzione CloudFront utilizzando un file JSON
L’esempio
create-distributionseguente crea una distribuzione per un bucket S3 denominatoamzn-s3-demo-buckete specifica ancheindex.htmlcome oggetto root predefinito utilizzando un file JSON.aws cloudfront create-distribution \ --distribution-configfile://dist-config.jsonContenuto di
dist-config.json.{ "CallerReference": "cli-example", "Aliases": { "Quantity": 0 }, "DefaultRootObject": "index.html", "Origins": { "Quantity": 1, "Items": [ { "Id": "amzn-s3-demo-bucket---s3.amazonaws.com.rproxy.govskope.ca-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.rproxy.govskope.ca-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 }Vedi l’esempio 1 per un output di esempio.
Esempio 3: creare una distribuzione CloudFront multi-tenant con un certificato
L’esempio
create-distributionseguente crea una distribuzione CloudFront con supporto multi-tenant e specifica un certificato TLS.aws cloudfront create-distribution \ --distribution-configfile://dist-config.jsonContenuto di
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 } } } ] } }Output:
{ "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" } } }Per ulteriori informazioni, consulta Lavorare con le distribuzioni nella Guida per gli sviluppatori di Amazon CloudFront.
Esempio 4: creare una distribuzione CloudFront multi-tenant senza un certificato
L’esempio
create-distributionseguente crea una distribuzione CloudFront con supporto multi-tenant ma senza un certificato TLS.aws cloudfront create-distribution \ --distribution-configfile://dist-config.jsonContenuto di
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 } } } ] } }Output:
{ "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" } } }Per ulteriori informazioni, consulta Configurare le distribuzioni nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta CreateDistribution
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare create-field-level-encryption-config.
- AWS CLI
-
Come creare una configurazione di crittografia a livello di campo CloudFront
L’esempio seguente crea una configurazione di crittografia a livello di campo fornendo i parametri di configurazione in un file JSON denominato
fle-config.json. Per creare una configurazione di crittografia a livello di campo, è necessario disporre di un profilo di crittografia allo stesso livello. Per creare un profilo, vedi il comando create-field-level-encryption-profile.Per ulteriori informazioni sulla crittografia a livello di campo CloudFront, consulta Utilizzo della crittografia a livello di campo per proteggere dati sensibili nella Guida per gli sviluppatori di Amazon CloudFront.
aws cloudfront create-field-level-encryption-config \ --field-level-encryption-configfile://fle-config.jsonIl file
fle-config.jsonè un documento JSON nella cartella corrente che contiene quanto segue:{ "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" } ] } } }Output:
{ "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" } ] } } } } }-
Per informazioni dettagliate sull’API, consulta CreateFieldLevelEncryptionConfig
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare create-field-level-encryption-profile.
- AWS CLI
-
Come creare un profilo di crittografia a livello di campo CloudFront
L’esempio seguente crea un profilo di crittografia a livello di campo fornendo i parametri in un file JSON denominato
fle-profile-config.json. Per creare un profilo di crittografia a livello di campo, è necessario disporre di una chiave pubblica CloudFront. Per creare una chiave pubblica CloudFront, vedi il comando create-public-key.Per ulteriori informazioni sulla crittografia a livello di campo CloudFront, consulta Utilizzo della crittografia a livello di campo per proteggere dati sensibili nella Guida per gli sviluppatori di Amazon CloudFront.
aws cloudfront create-field-level-encryption-profile \ --field-level-encryption-profile-configfile://fle-profile-config.jsonIl file
fle-profile-config.jsonè un documento JSON nella cartella corrente che contiene quanto segue:{ "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" ] } } ] } }Output:
{ "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" ] } } ] } } } }-
Per informazioni dettagliate sull’API, consulta CreateFieldLevelEncryptionProfile
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare create-invalidation-for-distribution-tenant.
- AWS CLI
-
Come creare un’invalidazione CloudFront per un tenant di distribuzione
L’esempio
create-invalidation-for-distribution-tenantseguente crea un’invalidazione per tutti i file in un tenant di distribuzione CloudFront.aws cloudfront create-invalidation-for-distribution-tenant \ --iddt_2wjDZi3hD1ivOXf6rpZJO1AB\ --invalidation-batch '{"Paths": {"Quantity": 1, "Items": ["/*"]}, "CallerReference": "invalidation-$(date +%s)"}'Output:
{ "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)" } } }Per ulteriori informazioni, consulta Invalidate files to remove content nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta CreateInvalidationForDistributionTenant
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare create-invalidation.
- AWS CLI
-
Come creare un’invalidazione per una distribuzione CloudFront
L’esempio
create-invalidationseguente crea un’invalidazione per i file specificati nella distribuzione CloudFront specificata:aws cloudfront create-invalidation \ --distribution-idEDFDVBD6EXAMPLE\ --paths"/example-path/example-file.jpg""/example-path/example-file2.png"Output:
{ "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" } } }Nell’esempio precedente, l’interfaccia della linea di comando AWS (AWS CLI) genera automaticamente un valore randomizzato
CallerReference. Per specificare i parametriCallerReferenceo per evitare di passare i parametri di invalidazione come argomenti della riga di comando, è possibile utilizzare un file JSON. L’esempio seguente crea un’invalidazione per due file fornendo i parametri di invalidazione in un file JSON denominatoinv-batch.json:aws cloudfront create-invalidation \ --distribution-idEDFDVBD6EXAMPLE\ --invalidation-batchfile://inv-batch.jsonContenuto di
inv-batch.json.{ "Paths": { "Quantity": 2, "Items": [ "/example-path/example-file.jpg", "/example-path/example-file2.png" ] }, "CallerReference": "cli-example" }Output:
{ "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" } } }-
Per informazioni dettagliate sull’API, consulta CreateInvalidation
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare create-public-key.
- AWS CLI
-
Come creare una chiave pubblica CloudFront
L’esempio seguente crea una chiave pubblica CloudFront fornendo i parametri in un file JSON denominato
pub-key-config.json. Per utilizzare questo comando, è necessario disporre di una chiave pubblica con codifica PEM. Per ulteriori informazioni, consulta Creare una coppia di chiavi RSA nella Guida per gli sviluppatori di Amazon CloudFront.aws cloudfront create-public-key \ --public-key-configfile://pub-key-config.jsonIl file
pub-key-config.jsonè un documento JSON nella cartella corrente che contiene quanto segue. Nota che la chiave pubblica è codificata in formato PEM.{ "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" }Output:
{ "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" } } }-
Per informazioni dettagliate sull’API, consulta CreatePublicKey
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare delete-cloud-front-origin-access-identity.
- AWS CLI
-
Come eliminare un’identità di accesso origine di CloudFront
Nell’esempio seguente viene eliminata l’identità di accesso origine (OAI) con l’ID
E74FTE3AEXAMPLE. Per eliminare un’identità di accesso origine (OAI), è necessario disporre dei relativiETage ID. L’ID dell’identità di accesso origine (OAI) viene restituito nell’output dei comandi create-cloud-front-origin-access-identity e list-cloud-front-origin-access-identities. Per ottenere il valoreETag, usa il comando get-cloud-front-origin-access-identity o get-cloud-front-origin-access-identity-config. Usa l’opzione--if-matchper fornire gliETagdell’identità di accesso origine (OAI).aws cloudfront delete-cloud-front-origin-access-identity \ --idE74FTE3AEXAMPLE\ --if-matchE2QWRUHEXAMPLESe ha esito positivo, questo comando non produce alcun output.
-
Per informazioni dettagliate sull’API, consulta DeleteCloudFrontOriginAccessIdentity
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare delete-connection-group.
- AWS CLI
-
Come eliminare un gruppo di connessioni
Nell’esempio seguente
delete-connection-groupelimina un gruppo di connessioni. Il gruppo di connessioni deve essere disabilitato e non può essere associato ad alcuna risorsa CloudFront.aws cloudfront delete-connection-group \ --idcg_2wjLpjbHkLUdhWAjHllcOeABC\ --if-matchETVPDKIKX0DABCSe ha esito positivo, questo comando non produce alcun output.
Per ulteriori informazioni sulla gestione dei gruppi di connessione, consulta Create custom connection group (optional) nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta DeleteConnectionGroup
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare delete-distribution-tenant.
- AWS CLI
-
Come eliminare un tenant di distribuzione
L’esempio
delete-distribution-tenantseguente elimina un tenant di distribuzione con ETagETVPDKIKX0DABC. Il tenant di distribuzione deve essere disabilitato e non può essere associato ad alcuna risorsa CloudFront.aws cloudfront delete-distribution-tenant \ --iddt_2wjMUbg3NHZEQ7OfoalP5zi1AB\ --if-matchETVPDKIKX0DABCSe ha esito positivo, questo comando non produce alcun output.
Per ulteriori informazioni, consulta Eliminazione di una distribuzione nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta DeleteDistributionTenant
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare delete-distribution.
- AWS CLI
-
Come eliminare una distribuzione CloudFront
L’esempio seguente elimina la distribuzione CloudFront con l’ID
EDFDVBD6EXAMPLE. Per eliminare una distribuzione, è necessario prima disabilitarla. Per disabilitare una distribuzione, usa il comando update-distribution. Per ulteriori informazioni, consulta gli esempi del comando update-distribution.Quando una distribuzione è disabilitata, è possibile eliminarla. Per eliminare una distribuzione, è necessario utilizzare l’opzione
--if-matchper fornire il valoreETagdella distribuzione. Per ottenere il valoreETag, usa il comando get-distribution o get-distribution-config.aws cloudfront delete-distribution \ --idEDFDVBD6EXAMPLE\ --if-matchE2QWRUHEXAMPLESe ha esito positivo, questo comando non produce alcun output.
-
Per informazioni dettagliate sull’API, consulta DeleteDistribution
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare delete-field-level-encryption-config.
- AWS CLI
-
Come eliminare una configurazione di crittografia a livello di campo CloudFront
L’esempio seguente elimina la configurazione di crittografia a livello di campo CloudFront con l’ID
C3KM2WVD605UAY. Per eliminare una configurazione di crittografia a livello di campo, è necessario disporre dei relativiETage ID. L’ID viene restituito nell’output dei comandi create-field-level-encryption-config e list-field-level-encryption-configs. Per ottenere il valoreETag, usa il comando get-field-level-encryption o get-field-level-encryption-config. Usa l’opzione--if-matchper fornire il valoreETagdella configurazione.aws cloudfront delete-field-level-encryption-config \ --idC3KM2WVD605UAY\ --if-matchE26M4BIAV81ZF6Se ha esito positivo, questo comando non produce alcun output.
-
Per informazioni dettagliate sull’API, consulta DeleteFieldLevelEncryptionConfig
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare delete-field-level-encryption-profile.
- AWS CLI
-
Come eliminare un profilo di crittografia a livello di campo CloudFront
L’esempio seguente elimina il profilo di crittografia a livello di campo CloudFront con l’ID
PPK0UOSIF5WSV. Per eliminare un profilo di crittografia a livello di campo, è necessario disporre dei relativiETage ID. L’ID viene restituito nell’output dei comandi create-field-level-encryption-profile e list-field-level-encryption-profiles. Per ottenere il valoreETag, usa il comando get-field-level-encryption-profile o get-field-level-encryption-profile-config. Usa l’opzione--if-matchper fornire gliETagdel profilo.aws cloudfront delete-field-level-encryption-profile \ --idPPK0UOSIF5WSV\ --if-matchEJETYFJ9CL66DSe ha esito positivo, questo comando non produce alcun output.
-
Per informazioni dettagliate sull’API, consulta DeleteFieldLevelEncryptionProfile
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare delete-public-key.
- AWS CLI
-
Come eliminare una chiave pubblica CloudFront
L’esempio seguente elimina la chiave pubblica CloudFront con l’ID
KDFB19YGCR002. Per eliminare una chiave pubblica, è necessario disporre dei relativiETage ID. L’ID viene restituito nell’output dei comandi create-public-key e list-public-keys. Per ottenere il valoreETag, usa il comando get-public-key o get-public-key-config. Usa l’opzione--if-matchper fornire gliETagdella chiave pubblica.aws cloudfront delete-public-key \ --idKDFB19YGCR002\ --if-matchE2QWRUHEXAMPLESe ha esito positivo, questo comando non produce alcun output.
-
Per informazioni dettagliate sull’API, consulta DeletePublicKey
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare disassociate-distribution-tenant-web-acl.
- AWS CLI
-
Come annullare l’associazione tra una lista di controllo degli accessi (ACL) web e un tenant di distribuzione
L’esempio
disassociate-distribution-tenant-web-aclseguente annulla l’associazione tra una lista di controllo degli accessi (ACL) web e un tenant di distribuzione con ETagE1PA6795UKMABC.aws cloudfront disassociate-distribution-tenant-web-acl \ --iddt_2wjDZi3hD1ivOXf6rpZJOSNE1AB\ --if-matchE1PA6795UKMABCOutput:
{ "ETag": "E13V1IB3VIYABC", "Id": "dt_2wjDZi3hD1ivOXf6rpZJOSNE1AB" }Per ulteriori informazioni, consulta Disable AWS WAF protections nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta DisassociateDistributionTenantWebAcl
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare disassociate-distribution-web-acl.
- AWS CLI
-
Come annullare l’associazione tra una lista di controllo degli accessi (ACL) web e una distribuzione CloudFront
Nell’esempio seguente
disassociate-distribution-web-aclrimuove l’associazione tra una lista di controllo degli accessi (ACL) web e una distribuzione CloudFront con ETagE13V1IB3VIYABC.aws cloudfront disassociate-distribution-web-acl \ --idE1XNX8R2GOAABC\ --if-matchEEZQ9Z24VM1ABCOutput:
{ "ETag": "E2YWS1C2J3OABC", "Id": "E1XNX8R2GOAABC" }Per ulteriori informazioni, consulta Disable AWS WAF protections nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta DisassociateDistributionWebAcl
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare get-cloud-front-origin-access-identity-config.
- AWS CLI
-
Come ottenere una configurazione dell’identità di accesso origine di CloudFront
L’esempio seguente ottiene i metadati dell’identità di accesso origine (OAI) di CloudFront con l’ID
E74FTE3AEXAMPLE, incluso il relativo valoreETag. L’ID dell’identità di accesso origine (OAI) viene restituito nell’output dei comandi create-cloud-front-origin-access-identity e list-cloud-front-origin-access-identities.aws cloudfront get-cloud-front-origin-access-identity-config --idE74FTE3AEXAMPLEOutput:
{ "ETag": "E2QWRUHEXAMPLE", "CloudFrontOriginAccessIdentityConfig": { "CallerReference": "cli-example", "Comment": "Example OAI" } }-
Per informazioni dettagliate sull’API, consulta GetCloudFrontOriginAccessIdentityConfig
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare get-cloud-front-origin-access-identity.
- AWS CLI
-
Come ottenere un’identità di accesso origine di CloudFront
L’esempio seguente ottiene i metadati dell’identità di accesso origine (OAI) di CloudFront con l’ID
E74FTE3AEXAMPLE, incluso il relativo valoreETage l’ID canonico S3 associato. L’ID dell’identità di accesso origine (OAI) viene restituito nell’output dei comandi create-cloud-front-origin-access-identity e list-cloud-front-origin-access-identities.aws cloudfront get-cloud-front-origin-access-identity --idE74FTE3AEXAMPLEOutput:
{ "ETag": "E2QWRUHEXAMPLE", "CloudFrontOriginAccessIdentity": { "Id": "E74FTE3AEXAMPLE", "S3CanonicalUserId": "cd13868f797c227fbea2830611a26fe0a21ba1b826ab4bed9b7771c9aEXAMPLE", "CloudFrontOriginAccessIdentityConfig": { "CallerReference": "cli-example", "Comment": "Example OAI" } } }-
Per informazioni dettagliate sull’API, consulta GetCloudFrontOriginAccessIdentity
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare get-connection-group-by-routing-endpoint.
- AWS CLI
-
Come ottenere un gruppo di connessione tramite un endpoint di routing
L’esempio
get-connection-group-by-routing-endpointseguente recupera le informazioni su un gruppo di connessioni utilizzando il relativo endpoint di routing.aws cloudfront get-connection-group-by-routing-endpoint \ --routing-endpointdvdg9gprgabc.cloudfront.net.rproxy.govskope.caOutput:
{ "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 } }Per ulteriori informazioni, consulta Create custom connection group (optional) nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta GetConnectionGroupByRoutingEndpoint
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare get-connection-group.
- AWS CLI
-
Come ottenere un gruppo di connessioni CloudFront
L’esempio
get-connection-groupseguente recupera le informazioni su un gruppo di connessioni CloudFront.aws cloudfront get-connection-group \ --identifiercg_2wjDWTBKTlRB87cAaUQFaakABCOutput:
{ "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 } }Per ulteriori informazioni, consulta Create custom connection group (optional) nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta GetConnectionGroup
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare get-distribution-config.
- AWS CLI
-
Come ottenere una configurazione di distribuzione CloudFront
L’esempio seguente ottiene i metadati della distribuzione CloudFront con l’ID
EDFDVBD6EXAMPLE, incluso il relativo valoreETag. L’ID distribuzione viene restituito nei comandi create-distribution e list-distribution.aws cloudfront get-distribution-config \ --idEDFDVBD6EXAMPLEOutput:
{ "ETag": "E2QWRUHEXAMPLE", "DistributionConfig": { "CallerReference": "cli-example", "Aliases": { "Quantity": 0 }, "DefaultRootObject": "index.html", "Origins": { "Quantity": 1, "Items": [ { "Id": "amzn-s3-demo-bucket---s3.amazonaws.com.rproxy.govskope.ca-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.rproxy.govskope.ca-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 } }-
Per informazioni dettagliate sull’API, consulta GetDistributionConfig
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare get-distribution-tenant-by-domain.
- AWS CLI
-
Come ottenere informazioni sui tenant di distribuzione per dominio
L’esempio
get-distribution-tenant-by-domainseguente recupera le informazioni su un tenant di distribuzione utilizzando il dominio specificato.aws cloudfront get-distribution-tenant-by-domain \ --domainexample.comOutput:
{ "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" } }Per ulteriori informazioni, consulta Understand how multi-tenant distributions work nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta GetDistributionTenantByDomain
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare get-distribution-tenant.
- AWS CLI
-
Come ottenere dettagli su un tenant di distribuzione CloudFront
L’esempio
get-distribution-tenantseguente recupera le informazioni relative a un tenant di distribuzione CloudFront.aws cloudfront get-distribution-tenant \ --iddt_2wjDZi3hD1ivOXf6rpZJOSNE1ABOutput:
{ "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" } }Per ulteriori informazioni, consulta Understand how multi-tenant distributions work nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta GetDistributionTenant
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare get-distribution.
- AWS CLI
-
Come ottenere una distribuzione CloudFront
L’esempio
get-distributionseguente ottiene la distribuzione CloudFront con l’IDEDFDVBD6EXAMPLE, incluso il relativo valoreETag. L’ID distribuzione viene restituito nei comandi create-distribution e list-distribution.aws cloudfront get-distribution \ --idEDFDVBD6EXAMPLEOutput:
{ "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.rproxy.govskope.ca-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.rproxy.govskope.ca-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 } } }-
Per informazioni dettagliate sull’API, consulta GetDistribution
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare get-field-level-encryption-config.
- AWS CLI
-
Come ottenere i metadati di una configurazione di crittografia a livello di campo CloudFront
L’esempio seguente ottiene i metadati della configurazione di crittografia a livello di campo CloudFront con l’ID
C3KM2WVD605UAY, incluso il relativo valoreETag:aws cloudfront get-field-level-encryption-config --idC3KM2WVD605UAYOutput:
{ "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" } ] } } } }-
Per informazioni dettagliate sull’API, consulta GetFieldLevelEncryptionConfig
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare get-field-level-encryption-profile-config.
- AWS CLI
-
Come ottenere una configurazione del profilo di crittografia a livello di campo CloudFront
L’esempio seguente ottiene i metadati del profilo di crittografia a livello di campo CloudFront con l’ID
PPK0UOSIF5WSV, incluso il relativo valoreETag:aws cloudfront get-field-level-encryption-profile-config --idPPK0UOSIF5WSVOutput:
{ "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" ] } } ] } } }-
Per informazioni dettagliate sull’API, consulta GetFieldLevelEncryptionProfileConfig
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare get-field-level-encryption-profile.
- AWS CLI
-
Come ottenere un profilo di crittografia a livello di campo CloudFront
L’esempio seguente ottiene il profilo di crittografia a livello di campo CloudFront con l’ID
PPK0UOSIF5WSV, incluso il relativo valoreETag:aws cloudfront get-field-level-encryption-profile --idPPK0UOSIF5WSVOutput:
{ "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" ] } } ] } } } }-
Per informazioni dettagliate sull’API, consulta GetFieldLevelEncryptionProfile
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare get-field-level-encryption.
- AWS CLI
-
Come ottenere una configurazione di crittografia a livello di campo CloudFront
L’esempio seguente ottiene la configurazione di crittografia a livello di campo CloudFront con l’ID
C3KM2WVD605UAY, incluso il relativo valoreETag:aws cloudfront get-field-level-encryption --idC3KM2WVD605UAYOutput:
{ "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" } ] } } } } }-
Per informazioni dettagliate sull’API, consulta GetFieldLevelEncryption
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare get-invalidation-for-distribution-tenant.
- AWS CLI
-
Come ottenere un’invalidazione per un tenant di distribuzione
L’esempio
get-invalidation-for-distribution-tenantseguente ottiene informazioni su un’invalidazione per un tenant di distribuzione.aws cloudfront get-invalidation-for-distribution-tenant \ --distribution-tenant-iddt_2wjDZi3hD1ivOXf6rpZJOSNE1AB\ --idI4CU23QAPKMUDUU06F9OFGFABCOutput:
{ "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" } } }Per ulteriori informazioni, consulta Invalidate files to remove content nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta GetInvalidationForDistributionTenant
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare get-invalidation.
- AWS CLI
-
Come ottenere un’invalidazione CloudFront
L’esempio seguente ottiene l’invalidazione con l’ID
I2J0I21PCUYOIKper la distribuzione CloudFront con l’IDEDFDVBD6EXAMPLE:aws cloudfront get-invalidation --idI2J0I21PCUYOIK--distribution-idEDFDVBD6EXAMPLEOutput:
{ "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" } }-
Per informazioni dettagliate sull’API, consulta GetInvalidation
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare get-managed-certificate-details.
- AWS CLI
-
Come ottenere i dettagli dei certificati gestiti
L’esempio
get-managed-certificate-detailsseguente recupera i dettagli di un certificato ACM gestito da CloudFront.aws cloudfront get-managed-certificate-details \ --identifierdt_2wjDZi3hD1ivOXf6rpZJOSNE1ABOutput:
{ "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" } ] } }Per ulteriori informazioni, consulta Request certificates for your CloudFront distribution tenant nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta GetManagedCertificateDetails
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare get-public-key-config.
- AWS CLI
-
Come ottenere una configurazione della chiave pubblica CloudFront
L’esempio seguente ottiene i metadati della chiave pubblica CloudFront con l’ID
KDFB19YGCR002, incluso il relativo valoreETag. L’ID viene restituito nell’output dei comandi create-public-key e list-public-keys.aws cloudfront get-public-key-config --idKDFB19YGCR002Output:
{ "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" } }-
Per informazioni dettagliate sull’API, consulta GetPublicKeyConfig
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare get-public-key.
- AWS CLI
-
Come ottenere una chiave pubblica CloudFront
L’esempio seguente ottiene la chiave pubblica CloudFront con l’ID
KDFB19YGCR002, incluso il relativo valoreETag. L’ID viene restituito nell’output dei comandi create-public-key e list-public-keys.aws cloudfront get-public-key --idKDFB19YGCR002Output:
{ "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" } } }-
Per informazioni dettagliate sull’API, consulta GetPublicKey
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare list-cloud-front-origin-access-identities.
- AWS CLI
-
Come elencare le identità di accesso origine di CloudFront
L’esempio seguente ottiene un elenco delle identità di accesso origine (OAI) di CloudFront nell’account AWS corrente.
aws cloudfront list-cloud-front-origin-access-identitiesOutput:
{ "CloudFrontOriginAccessIdentityList": { "Items": [ { "Id": "E74FTE3AEXAMPLE", "S3CanonicalUserId": "cd13868f797c227fbea2830611a26fe0a21ba1b826ab4bed9b7771c9aEXAMPLE", "Comment": "Example OAI" }, { "Id": "EH1HDMBEXAMPLE", "S3CanonicalUserId": "1489f6f2e6faacaae7ff64c4c3e6956c24f78788abfc1718c3527c263bf7a17EXAMPLE", "Comment": "Test OAI" }, { "Id": "E2X2C9TEXAMPLE", "S3CanonicalUserId": "cbfeebb915a64749f9be546a45b3fcfd3a31c779673c13c4dd460911ae402c2EXAMPLE", "Comment": "Example OAI #2" } ] } }-
Per informazioni dettagliate sull’API, consulta ListCloudFrontOriginAccessIdentities
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare list-connection-groups.
- AWS CLI
-
Come elencare i gruppi di connessioni
L’esempio
list-connection-groupsseguente elenca i gruppi di connessioni disponibili nell’account AWS corrente.aws cloudfront list-connection-groupsOutput:
{ "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 } ] }Per ulteriori informazioni, consulta Create custom connection group (optional) nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta ListConnectionGroups
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare list-distribution-tenants-by-customization.
- AWS CLI
-
Come elencare i tenant di distribuzione in base alla personalizzazione
L’esempio
list-distribution-tenants-by-customizationseguente elenca i tenant di distribuzione che utilizzano la lista di controllo degli accessi (ACL) web specificata.aws cloudfront list-distribution-tenants-by-customization \ --web-acl-arnarn:aws:wafv2:us-east-1:123456789012:global/webacl/CreatedByCloudFront-0273cd2f/a3c19bce-42b5-48a1-a8d4-b2bb2f28eabcOutput:
{ "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" } ] }Per ulteriori informazioni, consulta Distribution tenant customizations nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta ListDistributionTenantsByCustomization
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare list-distribution-tenants.
- AWS CLI
-
Come elencare i tenant di distribuzione CloudFront
L’esempio
list-distribution-tenantsseguente elenca 3 tenant di distribuzione CloudFront nell’account AWS corrente in base al gruppo di connessioni associato.aws cloudfront list-distribution-tenants \ --association-filterConnectionGroupId=cg_2whCJoXMYCjHcxaLGrkllvyABC\ --max-items3Output:
{ "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==" }Per ulteriori informazioni, consulta Understand how multi-tenant distributions work nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta ListDistributionTenants
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare list-distributions-by-connection-mode.
- AWS CLI
-
Come elencare le distribuzioni CloudFront in base alla modalità di connessione
L’esempio
list-distributions-by-connection-modeseguente elenca le distribuzioni CloudFront con la modalità di connessione specificata.aws cloudfront list-distributions-by-connection-mode \ --connection-modetenant-onlyOutput:
{ "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" } ] } }Per ulteriori informazioni, consulta Create custom connection group (optional) nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta ListDistributionsByConnectionMode
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare list-distributions.
- AWS CLI
-
Come elencare le distribuzioni CloudFront
Nell’esempio seguente viene restituito un elenco delle distribuzioni CloudFront nell’account AWS corrente.
aws cloudfront list-distributionsOutput:
{ "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 } ] } }-
Per informazioni dettagliate sull’API, consulta ListDistributions
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare list-domain-conflicts.
- AWS CLI
-
Come elencare i conflitti di dominio per una distribuzione CloudFront
L’esempio
list-domain-conflictsseguente elenca i conflitti di dominio per una distribuzione CloudFront.aws cloudfront list-domain-conflicts \ --domainexample.com\ --domain-control-validation-resource"DistributionTenantId=dt_2x9GhoK0TZRsohWzv1b9It8J1AB"Output:
{ "DomainConflicts": [ { "Domain": "example.com", "ResourceType": "distribution-tenant", "ResourceId": "***************ohWzv1b9It8J1AB", "AccountId": "123456789012" } ] }Per ulteriori informazioni, consulta Move an alternate domain name to a different distribution nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta ListDomainConflicts
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare list-field-level-encryption-configs.
- AWS CLI
-
Come elencare le configurazioni di crittografia a livello di campo CloudFront
L’esempio seguente ottiene un elenco delle configurazioni di crittografia a livello di campo CloudFront nell’account AWS corrente:
aws cloudfront list-field-level-encryption-configsOutput:
{ "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" } ] } } } ] } }-
Per informazioni dettagliate sull’API, consulta ListFieldLevelEncryptionConfigs
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare list-field-level-encryption-profiles.
- AWS CLI
-
Come elencare i profili di crittografia a livello di campo CloudFront
L’esempio seguente ottiene un elenco dei profili di crittografia a livello di campo CloudFront nell’account AWS corrente:
aws cloudfront list-field-level-encryption-profilesOutput:
{ "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" } ] } }-
Per informazioni dettagliate sull’API, consulta ListFieldLevelEncryptionProfiles
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare list-invalidations-for-distribution-tenant.
- AWS CLI
-
Come elencare le invalidazioni per un tenant di distribuzione CloudFront
L’esempio
list-invalidations-for-distribution-tenantseguente elenca le invalidazioni per un tenant di distribuzione CloudFront.aws cloudfront list-invalidations-for-distribution-tenant \ --iddt_2wjDZi3hD1ivOXf6rpZJOSNE1ABOutput:
{ "InvalidationList": { "Items": [ { "Id": "I4CU23QAPKMUDUU06F9OFGFABC", "CreateTime": "2025-05-06T15:46:12.824000+00:00", "Status": "Completed" } ] } }Per ulteriori informazioni, consulta Invalidate files to remove content nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta ListInvalidationsForDistributionTenant
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare list-invalidations.
- AWS CLI
-
Come elencare le invalidazioni CloudFront
L’esempio seguente ottiene un elenco di invalidazioni per la distribuzione CloudFront con l’ID
EDFDVBD6EXAMPLE:aws cloudfront list-invalidations --distribution-idEDFDVBD6EXAMPLEOutput:
{ "InvalidationList": { "Marker": "", "Items": [ { "Status": "Completed", "Id": "YNY2LI2BVJ4NJU", "CreateTime": "2019-08-31T21:15:52.042Z" } ], "IsTruncated": false, "MaxItems": 100, "Quantity": 1 } }-
Per informazioni dettagliate sull’API, consulta ListInvalidations
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare list-public-keys.
- AWS CLI
-
Come elencare le chiavi pubbliche CloudFront
Nell’esempio seguente viene restituito un elenco delle chiavi pubbliche CloudFront nell’account AWS corrente:
aws cloudfront list-public-keysOutput:
{ "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" } ] } }-
Per informazioni dettagliate sull’API, consulta ListPublicKeys
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare list-tags-for-resource.
- AWS CLI
-
Come elencare i tag per una distribuzione CloudFront
L’esempio seguente ottiene un elenco dei tag per una distribuzione CloudFront:
aws cloudfront list-tags-for-resource \ --resourcearn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLEOutput:
{ "Tags": { "Items": [ { "Key": "DateCreated", "Value": "2019-12-04" }, { "Key": "Name", "Value": "Example name" }, { "Key": "Project", "Value": "Example project" } ] } }-
Per informazioni dettagliate sull’API, consulta ListTagsForResource
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare sign.
- AWS CLI
-
Come firmare un URL CloudFront
L’esempio seguente firma un URL CloudFront. Per firmare un URL, sono necessari l’ID della coppia di chiavi (denominato ID chiave di accesso nella Console di gestione AWS) e la chiave privata della coppia di chiavi CloudFront del firmatario attendibile. Per ulteriori informazioni sugli URL firmati, consulta Esecuzione di contenuti privati con URL firmati e cookie firmati nella Guida per gli sviluppatori di Amazon CloudFront.
aws cloudfront sign \ --urlhttps://d111111abcdef8.cloudfront.net/private-content/private-file.html\ --key-pair-idAPKAEIBAERJR2EXAMPLE\ --private-keyfile://cf-signer-priv-key.pem\ --date-less-than2020-01-01Output:
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-
Per informazioni dettagliate sull’API, consulta Sign
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare tag-resource.
- AWS CLI
-
Come applicare un tag a una distribuzione CloudFront
L’esempio
tag-resourceseguente aggiunge due tag alla distribuzione CloudFront specificata.aws cloudfront tag-resource \ --resourcearn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE\ --tags 'Items=[{Key=Name,Value="Example name"},{Key=Project,Value="Example project"}]'Anziché utilizzare gli argomenti della riga di comando, è possibile fornire i tag in un file JSON, come mostrato nell’esempio seguente:
aws cloudfront tag-resource \ --resourcearn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE\ --tagsfile://tags.jsonContenuto di
tags.json.{ "Items": [ { "Key": "Name", "Value": "Example name" }, { "Key": "Project", "Value": "Example project" } ] }Questo comando non produce alcun output.
-
Per informazioni dettagliate sull’API, consulta TagResource
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare untag-resource.
- AWS CLI
-
Come rimuovere i tag da una distribuzione CloudFront
L’esempio seguente rimuove due tag da una distribuzione CloudFront utilizzando argomenti della riga di comando:
aws cloudfront untag-resource \ --resourcearn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE\ --tag-keysItems=Name,ProjectAnziché utilizzare gli argomenti della riga di comando, è possibile fornire le chiavi di tag in un file JSON, come mostrato nell’esempio seguente:
aws cloudfront untag-resource \ --resourcearn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE\ --tag-keysfile://tag-keys.jsonIl file
tag-keys.jsonè un documento JSON nella cartella corrente che contiene quanto segue:{ "Items": [ "Name", "Project" ] }Se ha esito positivo, questo comando non produce alcun output.
-
Per informazioni dettagliate sull’API, consulta UntagResource
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare update-cloud-front-origin-access-identity.
- AWS CLI
-
Come aggiornare un’identità di accesso origine di CloudFront
Nell’esempio seguente viene aggiornata l’identità di accesso origine (OAI) con l’ID
E74FTE3AEXAMPLE. L’unico campo che è possibile aggiornare è il campoCommentdell’identità di accesso origine (OAI).Per aggiornare un’identità di accesso origine (OAI), è necessario disporre dei relativi
ETage ID. L’ID dell’identità di accesso origine (OAI) viene restituito nell’output dei comandi create-cloud-front-origin-access-identity e list-cloud-front-origin-access-identities. Per ottenere il valoreETag, usa il comando get-cloud-front-origin-access-identity o get-cloud-front-origin-access-identity-config. Usa l’opzione--if-matchper fornire gliETagdell’identità di accesso origine (OAI).aws cloudfront update-cloud-front-origin-access-identity \ --idE74FTE3AEXAMPLE\ --if-matchE2QWRUHEXAMPLE\ --cloud-front-origin-access-identity-config \ CallerReference=cli-example,Comment="Example OAI Updated"È possibile ottenere lo stesso risultato indicando la configurazione OAI in un file JSON, come mostrato nell’esempio seguente:
aws cloudfront update-cloud-front-origin-access-identity \ --idE74FTE3AEXAMPLE\ --if-matchE2QWRUHEXAMPLE\ --cloud-front-origin-access-identity-configfile://OAI-config.jsonIl file
OAI-config.jsonè un documento JSON nella directory corrente che contiene quanto segue:{ "CallerReference": "cli-example", "Comment": "Example OAI Updated" }Sia che si fornisca la configurazione OAI con un argomento della riga di comando o con un file JSON, l’output è lo stesso:
{ "ETag": "E9LHASXEXAMPLE", "CloudFrontOriginAccessIdentity": { "Id": "E74FTE3AEXAMPLE", "S3CanonicalUserId": "cd13868f797c227fbea2830611a26fe0a21ba1b826ab4bed9b7771c9aEXAMPLE", "CloudFrontOriginAccessIdentityConfig": { "CallerReference": "cli-example", "Comment": "Example OAI Updated" } } }-
Per informazioni dettagliate sull’API, consulta UpdateCloudFrontOriginAccessIdentity
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare update-connection-group.
- AWS CLI
-
Come aggiornare un gruppo di connessioni CloudFront
L’esempio
update-connection-groupseguente disabilita un gruppo di connessioni CloudFront e disabilita IPv6.aws cloudfront update-connection-group \ --idcg_2yHsDkcPKeUlVkk3aEgLKcjABC\ --no-ipv6-enabled \ --no-enabled \ --if-matchE3UN6WX5RRO2ABCOutput:
{ "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 } }Per ulteriori informazioni, consulta Create custom connection group (optional) nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta UpdateConnectionGroup
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare update-distribution-tenant.
- AWS CLI
-
Come aggiornare un tenant di distribuzione CloudFront
L’esempio
update-distribution-tenantseguente aggiorna un tenant di distribuzione CloudFront con un nuovo valore di parametro e aggiunge un paese alle restrizioni geografiche.aws cloudfront update-distribution-tenant \ --cli-input-jsonfile://update-tenant.jsonContenuto di
update-tenant.json.{ "Id": "dt_2yMvQgam3QkJo2z54FDl91dk1AB", "IfMatch": "E1F83G8C2ARABC", "Parameters": [ { "Name": "testParam", "Value": "newParameterValue" } ], "Customizations": { "WebAcl": { "Action": "disable" }, "GeoRestrictions": { "RestrictionType": "whitelist", "Locations": [ "DE", "GB", "ES" ] } } }Output:
{ "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" } }Per ulteriori informazioni, consulta Distribution tenant customizations nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta UpdateDistributionTenant
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare update-distribution.
- AWS CLI
-
Esempio 1: aggiornare l’oggetto root predefinito di una distribuzione CloudFront
L’esempio seguente aggiorna l’oggetto root predefinito impostandolo su
index.htmlper la distribuzione CloudFront con l’IDEDFDVBD6EXAMPLE.aws cloudfront update-distribution \ --idEDFDVBD6EXAMPLE\ --default-root-objectindex.htmlOutput:
{ "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 } } }Esempio 2: aggiornare una distribuzione CloudFront
L’esempio seguente disabilita la distribuzione CloudFront con l’ID
EMLARXS9EXAMPLEfornendo la configurazione della distribuzione in un file JSON denominatodist-config-disable.json. Per aggiornare una distribuzione, è necessario utilizzare l’opzione--if-matchper fornire il valoreETagdella distribuzione. Per ottenere il valoreETag, usa il comando get-distribution o get-distribution-config. Nota che il campoEnabledè impostato sufalsenel file JSON.Dopo aver utilizzato l’esempio seguente per disabilitare una distribuzione, puoi utilizzare il comando delete-distribution per eliminarla.
aws cloudfront update-distribution \ --idEMLARXS9EXAMPLE\ --if-matchE2QWRUHEXAMPLE\ --distribution-configfile://dist-config-disable.jsonContenuto di
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.rproxy.govskope.ca-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.rproxy.govskope.ca-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 }Output:
{ "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.rproxy.govskope.ca-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.rproxy.govskope.ca-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 } } }-
Per informazioni dettagliate sull’API, consulta UpdateDistribution
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare update-domain-association.
- AWS CLI
-
Come aggiornare un’associazione di dominio
L’esempio
update-domain-associationseguente aggiorna un’associazione di dominio per un tenant di distribuzione con ETagE23ZP02F085ABC.aws cloudfront update-domain-association \ --domainexample.com\ --target-resourceDistributionTenantId=dt_2x9GhoK0TZRsohWzv1b9It8J1AB\ --if-matchE23ZP02F085ABCOutput:
{ "ETag": "ETVPDKIKX0ABC", "Domain": "example.com", "ResourceId": "dt_2x9GhoK0TZRsohWzv1b9It8J1AB" }Per ulteriori informazioni, consulta Move an alternate domain name to a different distribution nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta UpdateDomainAssociation
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare update-field-level-encryption-config.
- AWS CLI
-
Come aggiornare una configurazione di crittografia a livello di campo CloudFront
L’esempio seguente aggiorna il campo
Commentdella configurazione di crittografia a livello di campo con l’IDC3KM2WVD605UAYfornendo i parametri in un file JSON.Per aggiornare una configurazione di crittografia a livello di campo, è necessario disporre dei relativi
ETage ID. L’ID viene restituito nell’output dei comandi create-field-level-encryption-config e list-field-level-encryption-configs. Per ottenere il valoreETag, usa il comando get-field-level-encryption o get-field-level-encryption-config. Usa l’opzione--if-matchper fornire il valoreETagdella configurazione.aws cloudfront update-field-level-encryption-config \ --idC3KM2WVD605UAY\ --if-matchE2P4Z4VU7TY5SG\ --field-level-encryption-configfile://fle-config.jsonIl file
fle-config.jsonè un documento JSON nella directory corrente che contiene quanto segue:{ "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" } ] } } }Output:
{ "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" } ] } } } } }-
Per informazioni dettagliate sull’API, consulta UpdateFieldLevelEncryptionConfig
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare update-field-level-encryption-profile.
- AWS CLI
-
Come aggiornare un profilo di crittografia a livello di campo CloudFront
L’esempio seguente aggiorna il profilo di crittografia a livello di campo con l’ID
PPK0UOSIF5WSV. Nell’esempio vengono aggiornati i campiNameeCommentdel profilo e vene aggiunta una seconda voceFieldPatternsfornendo i parametri in un file JSON.Per aggiornare un profilo di crittografia a livello di campo, è necessario disporre dei relativi
ETage ID. L’ID viene restituito nell’output dei comandi create-field-level-encryption-profile e list-field-level-encryption-profiles. Per ottenere il valoreETag, usa il comando get-field-level-encryption-profile o get-field-level-encryption-profile-config. Usa l’opzione--if-matchper fornire gliETagdel profilo.aws cloudfront update-field-level-encryption-profile \ --idPPK0UOSIF5WSV\ --if-matchE1QQG65FS2L2GC\ --field-level-encryption-profile-configfile://fle-profile-config.jsonIl file
fle-profile-config.jsonè un documento JSON nella directory corrente che contiene quanto segue:{ "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" ] } } ] } }Output:
{ "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" ] } } ] } } } }-
Per informazioni dettagliate sull’API, consulta UpdateFieldLevelEncryptionProfile
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare verify-dns-configuration.
- AWS CLI
-
Come verificare la configurazione DNS per un dominio
L’esempio
verify-dns-configurationseguente verifica la configurazione DNS per un dominio.aws cloudfront verify-dns-configuration \ --domainexample.com\ --identifierdt_2x9GhoK0TZRsohWzv1b9It8J1ABOutput:
{ "DnsConfigurationList": [ { "Domain": "example.com", "Status": "valid-configuration" } ] }Per ulteriori informazioni, consulta Move an alternate domain name to a different distribution nella Guida per gli sviluppatori di Amazon CloudFront.
-
Per informazioni dettagliate sull’API, consulta VerifyDnsConfiguration
in AWS CLI Command Reference.
-