Esta documentação é somente para a versão 1 da AWS CLI. Para obter a documentação relacionada à AWS CLI versão 2, consulte o Guia do usuário da versão 2.
Exemplos do CloudFront usando a AWS CLI
Os exemplos de código a seguir mostram como realizar ações e implementar cenários comuns usando oAWS Command Line Interface com o CloudFront.
Ações são trechos de código de programas maiores e devem ser executadas em contexto. Embora as ações mostrem como chamar perfis de serviço individuais, você pode ver as ações no contexto em seus cenários relacionados.
Cada exemplo inclui um link para o código-fonte completo, em que você pode encontrar instruções sobre como configurar e executar o código.
Tópicos
Ações
O código de exemplo a seguir mostra como usar create-cloud-front-origin-access-identity
.
- AWS CLI
-
Para criar uma identidade do acesso de origem do CloudFront
O exemplo a seguir cria uma identidade do acesso de origem (OAI) do CloudFront fornecendo a configuração da OAI como um argumento da linha de comando:
aws cloudfront create-cloud-front-origin-access-identity \ --cloud-front-origin-access-identity-config \ CallerReference="cli-example",Comment="Example OAI"
Você pode fazer o mesmo fornecendo a configuração da OAI em um arquivo JSON, conforme mostrado no exemplo a seguir:
aws cloudfront create-cloud-front-origin-access-identity \ --cloud-front-origin-access-identity-config
file://OAI-config.json
O arquivo
OAI-config.json
é um documento JSON no diretório atual que contém o seguinte:{ "CallerReference": "cli-example", "Comment": "Example OAI" }
Se você fornecer a configuração da OAI com um argumento da linha de comando ou um arquivo JSON, a saída será a mesma:
{ "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" } } }
-
Para ver detalhes da API, consulte CreateCloudFrontOriginAccessIdentity
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar create-distribution-with-tags
.
- AWS CLI
-
Para criar uma distribuição do CloudFront com tags
O exemplo de
create-distribution-with-tags
a seguir cria uma distribuição com duas tags fornecendo a configuração de distribuição e as tags em um arquivo JSON chamadodist-config-with-tags.json
.aws cloudfront create-distribution-with-tags \ --distribution-config-with-tags
file://dist-config-with-tags.json
O arquivo
dist-config-with-tags.json
é um documento JSON na pasta atual. Observe o objetoTags
na parte superior do arquivo, que contém duas tags:Name = ExampleDistribution
Project = ExampleProject
Conteúdo de
dist-config-with-tags.json
:{ "Tags": { "Items": [ { "Key": "Name", "Value": "ExampleDistribution" }, { "Key": "Project", "Value": "ExampleProject" } ] }, "DistributionConfig": { "CallerReference": "cli-example", "Aliases": { "Quantity": 0 }, "DefaultRootObject": "index.html", "Origins": { "Quantity": 1, "Items": [ { "Id": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example", "DomainName": "amzn-s3-demo-bucket.s3.amazonaws.com", "OriginPath": "", "CustomHeaders": { "Quantity": 0 }, "S3OriginConfig": { "OriginAccessIdentity": "" } } ] }, "OriginGroups": { "Quantity": 0 }, "DefaultCacheBehavior": { "TargetOriginId": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example", "ForwardedValues": { "QueryString": false, "Cookies": { "Forward": "none" }, "Headers": { "Quantity": 0 }, "QueryStringCacheKeys": { "Quantity": 0 } }, "TrustedSigners": { "Enabled": false, "Quantity": 0 }, "ViewerProtocolPolicy": "allow-all", "MinTTL": 0, "AllowedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ], "CachedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ] } }, "SmoothStreaming": false, "DefaultTTL": 86400, "MaxTTL": 31536000, "Compress": false, "LambdaFunctionAssociations": { "Quantity": 0 }, "FieldLevelEncryptionId": "" }, "CacheBehaviors": { "Quantity": 0 }, "CustomErrorResponses": { "Quantity": 0 }, "Comment": "", "Logging": { "Enabled": false, "IncludeCookies": false, "Bucket": "", "Prefix": "" }, "PriceClass": "PriceClass_All", "Enabled": true, "ViewerCertificate": { "CloudFrontDefaultCertificate": true, "MinimumProtocolVersion": "TLSv1", "CertificateSource": "cloudfront" }, "Restrictions": { "GeoRestriction": { "RestrictionType": "none", "Quantity": 0 } }, "WebACLId": "", "HttpVersion": "http2", "IsIPV6Enabled": true } }
Saída:
{ "Location": "https://cloudfront.amazonaws.com/2019-03-26/distribution/EDFDVBD6EXAMPLE", "ETag": "E2QWRUHEXAMPLE", "Distribution": { "Id": "EDFDVBD6EXAMPLE", "ARN": "arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE", "Status": "InProgress", "LastModifiedTime": "2019-12-04T23:35:41.433Z", "InProgressInvalidationBatches": 0, "DomainName": "d111111abcdef8.cloudfront.net", "ActiveTrustedSigners": { "Enabled": false, "Quantity": 0 }, "DistributionConfig": { "CallerReference": "cli-example", "Aliases": { "Quantity": 0 }, "DefaultRootObject": "index.html", "Origins": { "Quantity": 1, "Items": [ { "Id": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example", "DomainName": "amzn-s3-demo-bucket.s3.amazonaws.com", "OriginPath": "", "CustomHeaders": { "Quantity": 0 }, "S3OriginConfig": { "OriginAccessIdentity": "" } } ] }, "OriginGroups": { "Quantity": 0 }, "DefaultCacheBehavior": { "TargetOriginId": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example", "ForwardedValues": { "QueryString": false, "Cookies": { "Forward": "none" }, "Headers": { "Quantity": 0 }, "QueryStringCacheKeys": { "Quantity": 0 } }, "TrustedSigners": { "Enabled": false, "Quantity": 0 }, "ViewerProtocolPolicy": "allow-all", "MinTTL": 0, "AllowedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ], "CachedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ] } }, "SmoothStreaming": false, "DefaultTTL": 86400, "MaxTTL": 31536000, "Compress": false, "LambdaFunctionAssociations": { "Quantity": 0 }, "FieldLevelEncryptionId": "" }, "CacheBehaviors": { "Quantity": 0 }, "CustomErrorResponses": { "Quantity": 0 }, "Comment": "", "Logging": { "Enabled": false, "IncludeCookies": false, "Bucket": "", "Prefix": "" }, "PriceClass": "PriceClass_All", "Enabled": true, "ViewerCertificate": { "CloudFrontDefaultCertificate": true, "MinimumProtocolVersion": "TLSv1", "CertificateSource": "cloudfront" }, "Restrictions": { "GeoRestriction": { "RestrictionType": "none", "Quantity": 0 } }, "WebACLId": "", "HttpVersion": "http2", "IsIPV6Enabled": true } } }
-
Para ver detalhes da API, consulte CreateDistributionWithTags
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar create-distribution
.
- AWS CLI
-
Exemplo 1: como criar uma distribuição do CloudFront
O exemplo a seguir cria uma distribuição para um bucket do S3 chamado
amzn-s3-demo-bucket
e também especificaindex.html
como o objeto raiz padrão, usando argumentos de linha de comandos.aws cloudfront create-distribution \ --origin-domain-name
amzn-s3-demo-bucket.s3.amazonaws.com
\ --default-root-objectindex.html
Saída:
{ "Location": "https://cloudfront.amazonaws.com/2019-03-26/distribution/EMLARXS9EXAMPLE", "ETag": "E9LHASXEXAMPLE", "Distribution": { "Id": "EMLARXS9EXAMPLE", "ARN": "arn:aws:cloudfront::123456789012:distribution/EMLARXS9EXAMPLE", "Status": "InProgress", "LastModifiedTime": "2019-11-22T00:55:15.705Z", "InProgressInvalidationBatches": 0, "DomainName": "d111111abcdef8.cloudfront.net", "ActiveTrustedSigners": { "Enabled": false, "Quantity": 0 }, "DistributionConfig": { "CallerReference": "cli-example", "Aliases": { "Quantity": 0 }, "DefaultRootObject": "index.html", "Origins": { "Quantity": 1, "Items": [ { "Id": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example", "DomainName": "amzn-s3-demo-bucket.s3.amazonaws.com", "OriginPath": "", "CustomHeaders": { "Quantity": 0 }, "S3OriginConfig": { "OriginAccessIdentity": "" } } ] }, "OriginGroups": { "Quantity": 0 }, "DefaultCacheBehavior": { "TargetOriginId": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example", "ForwardedValues": { "QueryString": false, "Cookies": { "Forward": "none" }, "Headers": { "Quantity": 0 }, "QueryStringCacheKeys": { "Quantity": 0 } }, "TrustedSigners": { "Enabled": false, "Quantity": 0 }, "ViewerProtocolPolicy": "allow-all", "MinTTL": 0, "AllowedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ], "CachedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ] } }, "SmoothStreaming": false, "DefaultTTL": 86400, "MaxTTL": 31536000, "Compress": false, "LambdaFunctionAssociations": { "Quantity": 0 }, "FieldLevelEncryptionId": "" }, "CacheBehaviors": { "Quantity": 0 }, "CustomErrorResponses": { "Quantity": 0 }, "Comment": "", "Logging": { "Enabled": false, "IncludeCookies": false, "Bucket": "", "Prefix": "" }, "PriceClass": "PriceClass_All", "Enabled": true, "ViewerCertificate": { "CloudFrontDefaultCertificate": true, "MinimumProtocolVersion": "TLSv1", "CertificateSource": "cloudfront" }, "Restrictions": { "GeoRestriction": { "RestrictionType": "none", "Quantity": 0 } }, "WebACLId": "", "HttpVersion": "http2", "IsIPV6Enabled": true } } }
Exemplo 2: como criar uma distribuição do CloudFront usando um arquivo JSON
O exemplo a seguir cria uma distribuição para um bucket do S3 chamado
amzn-s3-demo-bucket
e também especificaindex.html
como o objeto raiz padrão, usando um arquivo JSON.aws cloudfront create-distribution \ --distribution-config
file://dist-config.json
Conteúdo de
dist-config.json
:{ "CallerReference": "cli-example", "Aliases": { "Quantity": 0 }, "DefaultRootObject": "index.html", "Origins": { "Quantity": 1, "Items": [ { "Id": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example", "DomainName": "amzn-s3-demo-bucket.s3.amazonaws.com", "OriginPath": "", "CustomHeaders": { "Quantity": 0 }, "S3OriginConfig": { "OriginAccessIdentity": "" } } ] }, "OriginGroups": { "Quantity": 0 }, "DefaultCacheBehavior": { "TargetOriginId": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example", "ForwardedValues": { "QueryString": false, "Cookies": { "Forward": "none" }, "Headers": { "Quantity": 0 }, "QueryStringCacheKeys": { "Quantity": 0 } }, "TrustedSigners": { "Enabled": false, "Quantity": 0 }, "ViewerProtocolPolicy": "allow-all", "MinTTL": 0, "AllowedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ], "CachedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ] } }, "SmoothStreaming": false, "DefaultTTL": 86400, "MaxTTL": 31536000, "Compress": false, "LambdaFunctionAssociations": { "Quantity": 0 }, "FieldLevelEncryptionId": "" }, "CacheBehaviors": { "Quantity": 0 }, "CustomErrorResponses": { "Quantity": 0 }, "Comment": "", "Logging": { "Enabled": false, "IncludeCookies": false, "Bucket": "", "Prefix": "" }, "PriceClass": "PriceClass_All", "Enabled": true, "ViewerCertificate": { "CloudFrontDefaultCertificate": true, "MinimumProtocolVersion": "TLSv1", "CertificateSource": "cloudfront" }, "Restrictions": { "GeoRestriction": { "RestrictionType": "none", "Quantity": 0 } }, "WebACLId": "", "HttpVersion": "http2", "IsIPV6Enabled": true }
Consulte a amostra de saída no exemplo 1.
-
Para obter detalhes da API, consulte CreateDistribution
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar create-field-level-encryption-config
.
- AWS CLI
-
Para criar uma configuração de criptografia no nível de campo do CloudFront
O exemplo a seguir cria uma configuração de criptografia no nível de campo fornecendo os parâmetros de configuração em um arquivo JSON chamado
fle-config.json
. Antes de criar uma configuração de criptografia no nível de campo, você deve ter um perfil de criptografia no nível de campo. Para criar um perfil, consulte o comando create-field-level-encryption-profile.Para obter mais informações sobre a criptografia no nível de campo do CloudFront, consulte Como usar a criptografia no nível de campo para ajudar a proteger dados confidenciais no Guia do desenvolvedor do Amazon CloudFront.
aws cloudfront create-field-level-encryption-config \ --field-level-encryption-config
file://fle-config.json
O arquivo
fle-config.json
é um documento JSON na pasta atual que contém o seguinte:{ "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" } ] } } }
Saída:
{ "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" } ] } } } } }
-
Para ver detalhes da API, consulte CreateFieldLevelEncryptionConfig
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar create-field-level-encryption-profile
.
- AWS CLI
-
Para criar um perfil de criptografia no nível de campo do CloudFront
O exemplo a seguir cria um perfil de criptografia no nível de campo fornecendo os parâmetros em um arquivo JSON chamado
fle-profile-config.json
. Antes de criar um perfil de criptografia no nível de campo, você deve ter uma chave pública do CloudFront. Para criar uma chave pública do CloudFront, consulte o comando create-public-key.Para obter mais informações sobre a criptografia no nível de campo do CloudFront, consulte Como usar a criptografia no nível de campo para ajudar a proteger dados confidenciais no Guia do desenvolvedor do Amazon CloudFront.
aws cloudfront create-field-level-encryption-profile \ --field-level-encryption-profile-config
file://fle-profile-config.json
O arquivo
fle-profile-config.json
é um documento JSON na pasta atual que contém o seguinte:{ "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" ] } } ] } }
Saída:
{ "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" ] } } ] } } } }
-
Para ver detalhes da API, consulte CreateFieldLevelEncryptionProfile
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar create-invalidation
.
- AWS CLI
-
Como criar uma invalidação para uma distribuição do CloudFront
O exemplo
create-invalidation
a seguir cria uma invalidação para os arquivos especificados na distribuição especificada do CloudFront:aws cloudfront create-invalidation \ --distribution-id
EDFDVBD6EXAMPLE
\ --paths"/example-path/example-file.jpg"
"/example-path/example-file2.png"
Saída:
{ "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" } } }
No exemplo anterior, a AWS CLI gerou automaticamente um
CallerReference
aleatório. Para especificar seu próprioCallerReference
ou evitar passar os parâmetros de invalidação como argumentos da linha de comando, é possível usar um arquivo JSON. O exemplo a seguir cria uma invalidação para dois arquivos fornecendo os parâmetros de invalidação em um arquivo JSON chamadoinv-batch.json
:aws cloudfront create-invalidation \ --distribution-id
EDFDVBD6EXAMPLE
\ --invalidation-batchfile://inv-batch.json
Conteúdo de
inv-batch.json
:{ "Paths": { "Quantity": 2, "Items": [ "/example-path/example-file.jpg", "/example-path/example-file2.png" ] }, "CallerReference": "cli-example" }
Saída:
{ "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" } } }
-
Para detalhes da API, consulte CreateInvalidation
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar create-public-key
.
- AWS CLI
-
Como criar uma chave pública do CloudFront
O exemplo a seguir cria uma chave pública do CloudFront fornecendo os parâmetros em um arquivo JSON chamado
pub-key-config.json
. Antes de usar esse comando, você deve ter uma chave pública codificada em PEM. Para obter mais informações, consulte Criar um par de chaves do RSA no Guia do desenvolvedor do Amazon CloudFront.aws cloudfront create-public-key \ --public-key-config
file://pub-key-config.json
O arquivo
pub-key-config.json
é um documento JSON na pasta atual que contém o seguinte. Observe que a chave pública é codificada no 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" }
Saída:
{ "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" } } }
-
Para obter detalhes da API, consulte CreatePublicKey
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar delete-cloud-front-origin-access-identity
.
- AWS CLI
-
Para excluir uma identidade do acesso de origem do CloudFront
O exemplo a seguir exclui a identidade do acesso de origem (OAI) com o ID
E74FTE3AEXAMPLE
. Para excluir uma OAI, você deve ter o ID da OAI e aETag
. O ID da OAI é retornado na saída dos comandos create-cloud-front-origin-access-identity e list-cloud-front-origin-access-identities. Para obter aETag
, use o comando get-cloud-front-origin-access-identity ou get-cloud-front-origin-access-identity-config. Use a opção--if-match
para fornecer aETag
da OAI.aws cloudfront delete-cloud-front-origin-access-identity \ --id
E74FTE3AEXAMPLE
\ --if-matchE2QWRUHEXAMPLE
Quando bem-sucedido, este comando não tem saída.
-
Para ver detalhes da API, consulte DeleteCloudFrontOriginAccessIdentity
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar delete-distribution
.
- AWS CLI
-
Como excluir uma distribuição do CloudFront
O exemplo a seguir exclui a distribuição do CloudFront com o ID
EDFDVBD6EXAMPLE
. Você deve desabilitar uma distribuição antes de exclui-la. Use o comando update-distribution para desabilitar uma distribuição. Para obter mais informações, consulte exemplos do comando update-distribution.Uma distribuição pode ser excluída depois de ser desabilitada. Para excluir uma distribuição, use a opção
--if-match
para fornecer oETag
da distribuição. Use o comando get-distribution ou get-distribution-config para obter oETag
.aws cloudfront delete-distribution \ --id
EDFDVBD6EXAMPLE
\ --if-matchE2QWRUHEXAMPLE
Quando bem-sucedido, este comando não tem saída.
-
Para obter detalhes da API, consulte DeleteDistribution
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar delete-field-level-encryption-config
.
- AWS CLI
-
Para excluir uma configuração de criptografia no nível de campo do CloudFront
O exemplo a seguir exclui a configuração de criptografia no nível de campo do CloudFront com o ID
C3KM2WVD605UAY
. Para excluir uma configuração de criptografia no nível de campo, você deve ter o ID e aETag
. O ID é retornado na saída dos comandos create-field-level-encryption-config e list-field-level-encryption-configs. Para obter aETag
, use o comando get-field-level-encryption ou get-field-level-encryption-config. Use a opção--if-match
para fornecer aETag
das configurações.aws cloudfront delete-field-level-encryption-config \ --id
C3KM2WVD605UAY
\ --if-matchE26M4BIAV81ZF6
Quando bem-sucedido, este comando não tem saída.
-
Para ver detalhes da API, consulte DeleteFieldLevelEncryptionConfig
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar delete-field-level-encryption-profile
.
- AWS CLI
-
Para excluir um perfil de criptografia no nível de campo do CloudFront
O exemplo a seguir exclui o perfil de criptografia no nível de campo do CloudFront com o ID
PPK0UOSIF5WSV
. Para excluir um perfil de criptografia no nível de campo, você deve ter o ID e aETag
. O ID é retornado na saída dos comandos create-field-level-encryption-profile e list-field-level-encryption-profiles. Para obter aETag
, use o comando get-field-level-encryption-profile ou get-field-level-encryption-profile-config. Use a opção--if-match
para fornecer aETag
do perfil.aws cloudfront delete-field-level-encryption-profile \ --id
PPK0UOSIF5WSV
\ --if-matchEJETYFJ9CL66D
Quando bem-sucedido, este comando não tem saída.
-
Para ver detalhes da API, consulte DeleteFieldLevelEncryptionProfile
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar delete-public-key
.
- AWS CLI
-
Para excluir uma chave pública do CloudFront
O exemplo a seguir exclui a chave pública do CloudFront com o ID
KDFB19YGCR002
. Para excluir uma chave pública, você deve ter seu ID eETag
. O ID é retornado na saída dos comandos create-public-key e list-public-keys. Para obter aETag
, use o comando get-public-key ou get-public-key-config. Use a opção--if-match
para fornecer aETag
da chave pública.aws cloudfront delete-public-key \ --id
KDFB19YGCR002
\ --if-matchE2QWRUHEXAMPLE
Quando bem-sucedido, este comando não tem saída.
-
Para ver detalhes da API, consulte DeletePublicKey
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar get-cloud-front-origin-access-identity-config
.
- AWS CLI
-
Como obter uma configuração de identidade do acesso de origem do CloudFront
O exemplo a seguir obtém metadados sobre a identidade do acesso de origem (OAI) do CloudFront com o ID
E74FTE3AEXAMPLE
, incluindo aETag
. O ID da OAI é retornado na saída dos comandos create-cloud-front-origin-access-identity e list-cloud-front-origin-access-identities.aws cloudfront get-cloud-front-origin-access-identity-config --id
E74FTE3AEXAMPLE
Saída:
{ "ETag": "E2QWRUHEXAMPLE", "CloudFrontOriginAccessIdentityConfig": { "CallerReference": "cli-example", "Comment": "Example OAI" } }
-
Para obter detalhes da API, consulte GetCloudFrontOriginAccessIdentityConfig
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar get-cloud-front-origin-access-identity
.
- AWS CLI
-
Para obter uma identidade do acesso de origem do CloudFront
O exemplo a seguir obtém a identidade do acesso de origem (OAI) do CloudFront com a ID
E74FTE3AEXAMPLE
, incluindo suaETag
e a ID canônica associada do S3. O ID da OAI é retornado na saída dos comandos create-cloud-front-origin-access-identity e list-cloud-front-origin-access-identities.aws cloudfront get-cloud-front-origin-access-identity --id
E74FTE3AEXAMPLE
Saída:
{ "ETag": "E2QWRUHEXAMPLE", "CloudFrontOriginAccessIdentity": { "Id": "E74FTE3AEXAMPLE", "S3CanonicalUserId": "cd13868f797c227fbea2830611a26fe0a21ba1b826ab4bed9b7771c9aEXAMPLE", "CloudFrontOriginAccessIdentityConfig": { "CallerReference": "cli-example", "Comment": "Example OAI" } } }
-
Para obter detalhes da API, consulte GetCloudFrontOriginAccessIdentity
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar get-distribution-config
.
- AWS CLI
-
Como obter uma configuração de distribuição do CloudFront
O exemplo a seguir obtém metadados sobre a distribuição do CloudFront com o ID
EDFDVBD6EXAMPLE
, incluindo oETag
. O ID de distribuição é retornado nos comandos create-distribution e list-distributions.aws cloudfront get-distribution-config \ --id
EDFDVBD6EXAMPLE
Saída:
{ "ETag": "E2QWRUHEXAMPLE", "DistributionConfig": { "CallerReference": "cli-example", "Aliases": { "Quantity": 0 }, "DefaultRootObject": "index.html", "Origins": { "Quantity": 1, "Items": [ { "Id": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example", "DomainName": "amzn-s3-demo-bucket.s3.amazonaws.com", "OriginPath": "", "CustomHeaders": { "Quantity": 0 }, "S3OriginConfig": { "OriginAccessIdentity": "" } } ] }, "OriginGroups": { "Quantity": 0 }, "DefaultCacheBehavior": { "TargetOriginId": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example", "ForwardedValues": { "QueryString": false, "Cookies": { "Forward": "none" }, "Headers": { "Quantity": 0 }, "QueryStringCacheKeys": { "Quantity": 0 } }, "TrustedSigners": { "Enabled": false, "Quantity": 0 }, "ViewerProtocolPolicy": "allow-all", "MinTTL": 0, "AllowedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ], "CachedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ] } }, "SmoothStreaming": false, "DefaultTTL": 86400, "MaxTTL": 31536000, "Compress": false, "LambdaFunctionAssociations": { "Quantity": 0 }, "FieldLevelEncryptionId": "" }, "CacheBehaviors": { "Quantity": 0 }, "CustomErrorResponses": { "Quantity": 0 }, "Comment": "", "Logging": { "Enabled": false, "IncludeCookies": false, "Bucket": "", "Prefix": "" }, "PriceClass": "PriceClass_All", "Enabled": true, "ViewerCertificate": { "CloudFrontDefaultCertificate": true, "MinimumProtocolVersion": "TLSv1", "CertificateSource": "cloudfront" }, "Restrictions": { "GeoRestriction": { "RestrictionType": "none", "Quantity": 0 } }, "WebACLId": "", "HttpVersion": "http2", "IsIPV6Enabled": true } }
-
Para obter detalhes da API, consulte GetDistributionConfig
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar get-distribution
.
- AWS CLI
-
Como obter uma distribuição do CloudFront
O exemplo de
get-distribution
a seguir obtém a distribuição do CloudFront com o IDEDFDVBD6EXAMPLE
, incluindo a respectivaETag
. O ID de distribuição é retornado nos comandos create-distribution e list-distributions.aws cloudfront get-distribution \ --id
EDFDVBD6EXAMPLE
Saída:
{ "ETag": "E2QWRUHEXAMPLE", "Distribution": { "Id": "EDFDVBD6EXAMPLE", "ARN": "arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE", "Status": "Deployed", "LastModifiedTime": "2019-12-04T23:35:41.433Z", "InProgressInvalidationBatches": 0, "DomainName": "d111111abcdef8.cloudfront.net", "ActiveTrustedSigners": { "Enabled": false, "Quantity": 0 }, "DistributionConfig": { "CallerReference": "cli-example", "Aliases": { "Quantity": 0 }, "DefaultRootObject": "index.html", "Origins": { "Quantity": 1, "Items": [ { "Id": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example", "DomainName": "amzn-s3-demo-bucket.s3.amazonaws.com", "OriginPath": "", "CustomHeaders": { "Quantity": 0 }, "S3OriginConfig": { "OriginAccessIdentity": "" } } ] }, "OriginGroups": { "Quantity": 0 }, "DefaultCacheBehavior": { "TargetOriginId": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example", "ForwardedValues": { "QueryString": false, "Cookies": { "Forward": "none" }, "Headers": { "Quantity": 0 }, "QueryStringCacheKeys": { "Quantity": 0 } }, "TrustedSigners": { "Enabled": false, "Quantity": 0 }, "ViewerProtocolPolicy": "allow-all", "MinTTL": 0, "AllowedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ], "CachedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ] } }, "SmoothStreaming": false, "DefaultTTL": 86400, "MaxTTL": 31536000, "Compress": false, "LambdaFunctionAssociations": { "Quantity": 0 }, "FieldLevelEncryptionId": "" }, "CacheBehaviors": { "Quantity": 0 }, "CustomErrorResponses": { "Quantity": 0 }, "Comment": "", "Logging": { "Enabled": false, "IncludeCookies": false, "Bucket": "", "Prefix": "" }, "PriceClass": "PriceClass_All", "Enabled": true, "ViewerCertificate": { "CloudFrontDefaultCertificate": true, "MinimumProtocolVersion": "TLSv1", "CertificateSource": "cloudfront" }, "Restrictions": { "GeoRestriction": { "RestrictionType": "none", "Quantity": 0 } }, "WebACLId": "", "HttpVersion": "http2", "IsIPV6Enabled": true } } }
-
Para obter detalhes da API, consulte GetDistribution
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar get-field-level-encryption-config
.
- AWS CLI
-
Para obter metadados sobre uma configuração de criptografia no nível de campo do CloudFront
O exemplo a seguir obtém metadados sobre a configuração de criptografia no nível de campo do CloudFront com o ID
C3KM2WVD605UAY
, incluindo aETag
:aws cloudfront get-field-level-encryption-config --id
C3KM2WVD605UAY
Saída:
{ "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" } ] } } } }
-
Para ver detalhes da API, consulte GetFieldLevelEncryptionConfig
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar get-field-level-encryption-profile-config
.
- AWS CLI
-
Para obter uma configuração de perfil de criptografia no nível de campo do CloudFront
O exemplo a seguir obtém metadados sobre o perfil de criptografia no nível de campo do CloudFront com o ID
PPK0UOSIF5WSV
, incluindo aETag
:aws cloudfront get-field-level-encryption-profile-config --id
PPK0UOSIF5WSV
Saída:
{ "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" ] } } ] } } }
-
Para ver detalhes da API, consulte GetFieldLevelEncryptionProfileConfig
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar get-field-level-encryption-profile
.
- AWS CLI
-
Para obter um perfil de criptografia no nível de campo do CloudFront
O exemplo a seguir obtém o perfil de criptografia no nível de campo do CloudFront com o ID
PPK0UOSIF5WSV
, incluindo aETag
:aws cloudfront get-field-level-encryption-profile --id
PPK0UOSIF5WSV
Saída:
{ "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" ] } } ] } } } }
-
Para ver detalhes da API, consulte GetFieldLevelEncryptionProfile
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar get-field-level-encryption
.
- AWS CLI
-
Para obter uma configuração de criptografia no nível de campo do CloudFront
O exemplo a seguir obtém a configuração de criptografia no nível de campo do CloudFront com o ID
C3KM2WVD605UAY
, incluindo aETag
:aws cloudfront get-field-level-encryption --id
C3KM2WVD605UAY
Saída:
{ "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" } ] } } } } }
-
Para ver detalhes da API, consulte GetFieldLevelEncryption
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar get-invalidation
.
- AWS CLI
-
Para obter uma invalidação do CloudFront
O exemplo a seguir obtém a invalidação com o ID
I2J0I21PCUYOIK
da distribuição do CloudFront com o IDEDFDVBD6EXAMPLE
:aws cloudfront get-invalidation --id
I2J0I21PCUYOIK
--distribution-idEDFDVBD6EXAMPLE
Saída:
{ "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" } }
-
Para ver detalhes da API, consulte GetInvalidation
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar get-public-key-config
.
- AWS CLI
-
Para obter uma configuração de chave pública do CloudFront
O exemplo a seguir obtém metadados sobre a chave pública do CloudFront com o ID
KDFB19YGCR002
, incluindo aETag
. O ID da chave pública é retornado nos comandos create-public-key e list-public-keys.aws cloudfront get-public-key-config --id
KDFB19YGCR002
Saída:
{ "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" } }
-
Para ver detalhes da API, consulte GetPublicKeyConfig
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar get-public-key
.
- AWS CLI
-
Para obter uma chave pública do CloudFront
O exemplo a seguir obtém a chave pública do CloudFront com o ID
KDFB19YGCR002
, incluindo aETag
. O ID da chave pública é retornado nos comandos create-public-key e list-public-keys.aws cloudfront get-public-key --id
KDFB19YGCR002
Saída:
{ "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" } } }
-
Para ver detalhes da API, consulte GetPublicKey
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar list-cloud-front-origin-access-identities
.
- AWS CLI
-
Para listar as identidades do acesso de origem do CloudFront
O exemplo a seguir obtém uma lista das identidades do acesso de origem (OAIs) do CloudFront na sua conta da AWS:
aws cloudfront list-cloud-front-origin-access-identities
Saída:
{ "CloudFrontOriginAccessIdentityList": { "Items": [ { "Id": "E74FTE3AEXAMPLE", "S3CanonicalUserId": "cd13868f797c227fbea2830611a26fe0a21ba1b826ab4bed9b7771c9aEXAMPLE", "Comment": "Example OAI" }, { "Id": "EH1HDMBEXAMPLE", "S3CanonicalUserId": "1489f6f2e6faacaae7ff64c4c3e6956c24f78788abfc1718c3527c263bf7a17EXAMPLE", "Comment": "Test OAI" }, { "Id": "E2X2C9TEXAMPLE", "S3CanonicalUserId": "cbfeebb915a64749f9be546a45b3fcfd3a31c779673c13c4dd460911ae402c2EXAMPLE", "Comment": "Example OAI #2" } ] } }
-
Para obter detalhes da API, consulte ListCloudFrontOriginAccessIdentities
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar list-distributions
.
- AWS CLI
-
Para listar as distribuições do CloudFront
O exemplo a seguir obtém uma lista de distribuições do CloudFront em sua conta da AWS.
aws cloudfront list-distributions
Saída:
{ "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 } ] } }
-
Para obter detalhes da API, consulte ListDistributions
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar list-field-level-encryption-configs
.
- AWS CLI
-
Para listar as configurações de criptografia no nível de campo do CloudFront
O exemplo a seguir obtém uma lista das configurações de criptografia no nível de campo do CloudFront na sua conta da AWS:
aws cloudfront list-field-level-encryption-configs
Saída:
{ "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" } ] } } } ] } }
-
Para ver detalhes da API, consulte ListFieldLevelEncryptionConfigs
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar list-field-level-encryption-profiles
.
- AWS CLI
-
Para listar perfis de criptografia no nível de campo do CloudFront
O exemplo a seguir obtém uma lista dos perfis de criptografia no nível de campo do CloudFront na sua conta da AWS:
aws cloudfront list-field-level-encryption-profiles
Saída:
{ "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" } ] } }
-
Para ver detalhes da API, consulte ListFieldLevelEncryptionProfiles
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar list-invalidations
.
- AWS CLI
-
Para listar as invalidações do CloudFront
O exemplo a seguir obtém uma lista das invalidações da distribuição do CloudFront com o ID
EDFDVBD6EXAMPLE
:aws cloudfront list-invalidations --distribution-id
EDFDVBD6EXAMPLE
Saída:
{ "InvalidationList": { "Marker": "", "Items": [ { "Status": "Completed", "Id": "YNY2LI2BVJ4NJU", "CreateTime": "2019-08-31T21:15:52.042Z" } ], "IsTruncated": false, "MaxItems": 100, "Quantity": 1 } }
-
Para ver detalhes da API, consulte ListInvalidations
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar list-public-keys
.
- AWS CLI
-
Para listar as chaves públicas do CloudFront
O seguinte exemplo obtém uma lista das chaves públicas do CloudFront em sua conta da AWS:
aws cloudfront list-public-keys
Saída:
{ "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" } ] } }
-
Para ver detalhes da API, consulte ListPublicKeys
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar list-tags-for-resource
.
- AWS CLI
-
Para listar tags para uma distribuição do CloudFront
O seguinte exemplo obtém uma lista das tags de uma distribuição do CloudFront:
aws cloudfront list-tags-for-resource \ --resource
arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE
Saída:
{ "Tags": { "Items": [ { "Key": "DateCreated", "Value": "2019-12-04" }, { "Key": "Name", "Value": "Example name" }, { "Key": "Project", "Value": "Example project" } ] } }
-
Para obter detalhes sobre a API, consulte ListTagsForResource
na AWS CLI Command Reference.
-
O código de exemplo a seguir mostra como usar sign
.
- AWS CLI
-
Como assinar um URL do CloudFront
O exemplo a seguir assina um URL do CloudFront. Para assinar um URL, você precisa do ID do par de chaves (chamado de ID da chave de acesso no console de gerenciamento da AWS) e da chave privada do par de chaves do CloudFront do signatário confiável. Para obter mais informações sobre URLs assinados, consulte Veicular conteúdo privado com URLs assinados e cookies assinados no Guia do desenvolvedor do Amazon CloudFront.
aws cloudfront sign \ --url
https://d111111abcdef8.cloudfront.net/private-content/private-file.html
\ --key-pair-idAPKAEIBAERJR2EXAMPLE
\ --private-keyfile://cf-signer-priv-key.pem
\ --date-less-than2020-01-01
Saída:
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
-
Para ver detalhes da API, consulte Sign
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar tag-resource
.
- AWS CLI
-
Como marcar uma distribuição do CloudFront
O exemplo
tag-resource
a seguir adiciona duas tags à distribuição do CloudFront especificada.aws cloudfront tag-resource \ --resource
arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE
\ --tags 'Items=[{Key=Name,Value="Example name"},{Key=Project,Value="Example project"}]
'Em vez de usar argumentos de linha de comando, forneça as tags em um arquivo JSON, conforme mostrado no seguinte exemplo:
aws cloudfront tag-resource \ --resource
arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE
\ --tagsfile://tags.json
Conteúdo de
tags.json
:{ "Items": [ { "Key": "Name", "Value": "Example name" }, { "Key": "Project", "Value": "Example project" } ] }
Este comando não produz saída.
-
Para obter detalhes da API, consulte TagResource
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar untag-resource
.
- AWS CLI
-
Para remover tags de uma distribuição do CloudFront
O exemplo a seguir remove duas tags de uma distribuição do CloudFront usando argumentos de linha de comando:
aws cloudfront untag-resource \ --resource
arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE
\ --tag-keysItems=Name,Project
Em vez de usar argumentos de linha de comando, forneça as chaves de tag em um arquivo JSON, conforme mostrado no seguinte exemplo:
aws cloudfront untag-resource \ --resource
arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE
\ --tag-keysfile://tag-keys.json
O arquivo
tag-keys.json
é um documento JSON na pasta atual que contém o seguinte:{ "Items": [ "Name", "Project" ] }
Quando bem-sucedido, este comando não tem saída.
-
Para obter detalhes sobre a API, consulte UntagResource
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar update-cloud-front-origin-access-identity
.
- AWS CLI
-
Para atualizar uma identidade do acesso de origem do CloudFront
O exemplo a seguir atualiza a identidade do acesso de origem (OAI) com o ID
E74FTE3AEXAMPLE
. O único campo que você pode atualizar éComment
da OAI.Para atualizar uma OAI, você deve ter o ID da OAI e a
ETag
. O ID da OAI é retornado na saída dos comandos create-cloud-front-origin-access-identity e list-cloud-front-origin-access-identities. Para obter aETag
, use o comando get-cloud-front-origin-access-identity ou get-cloud-front-origin-access-identity-config. Use a opção--if-match
para fornecer aETag
da OAI.aws cloudfront update-cloud-front-origin-access-identity \ --id
E74FTE3AEXAMPLE
\ --if-matchE2QWRUHEXAMPLE
\ --cloud-front-origin-access-identity-config \ CallerReference=cli-example,Comment="Example OAI Updated"Você pode fazer o mesmo fornecendo a configuração da OAI em um arquivo JSON, conforme mostrado no exemplo a seguir:
aws cloudfront update-cloud-front-origin-access-identity \ --id
E74FTE3AEXAMPLE
\ --if-matchE2QWRUHEXAMPLE
\ --cloud-front-origin-access-identity-configfile://OAI-config.json
O arquivo
OAI-config.json
é um documento JSON no diretório atual que contém o seguinte:{ "CallerReference": "cli-example", "Comment": "Example OAI Updated" }
Se você fornecer a configuração da OAI com um argumento da linha de comando ou um arquivo JSON, a saída será a mesma:
{ "ETag": "E9LHASXEXAMPLE", "CloudFrontOriginAccessIdentity": { "Id": "E74FTE3AEXAMPLE", "S3CanonicalUserId": "cd13868f797c227fbea2830611a26fe0a21ba1b826ab4bed9b7771c9aEXAMPLE", "CloudFrontOriginAccessIdentityConfig": { "CallerReference": "cli-example", "Comment": "Example OAI Updated" } } }
-
Para ver detalhes da API, consulte UpdateCloudFrontOriginAccessIdentity
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar update-distribution
.
- AWS CLI
-
Exemplo 1: como atualizar o objeto raiz padrão de uma distribuição do CloudFront
O exemplo a seguir atualiza o objeto raiz padrão para
index.html
para a distribuição do CloudFront com o IDEDFDVBD6EXAMPLE
.aws cloudfront update-distribution \ --id
EDFDVBD6EXAMPLE
\ --default-root-objectindex.html
Saída:
{ "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 } } }
Exemplo 2: como atualizar uma distribuição do CloudFront
O exemplo a seguir desabilita a distribuição do CloudFront com o ID
EMLARXS9EXAMPLE
fornecendo a configuração de distribuição em um arquivo JSON chamadodist-config-disable.json
. Para atualizar uma distribuição, use a opção--if-match
para fornecer oETag
da distribuição. Use o comando get-distribution ou get-distribution-config para obter oETag
. Observe que o campoEnabled
está definido comofalse
no arquivo JSON.Depois de usar o exemplo a seguir para desabilitar uma distribuição, use o comando delete-distribution para exclui-la.
aws cloudfront update-distribution \ --id
EMLARXS9EXAMPLE
\ --if-matchE2QWRUHEXAMPLE
\ --distribution-configfile://dist-config-disable.json
Conteúdo de
dist-config-disable.json
:{ "CallerReference": "cli-1574382155-496510", "Aliases": { "Quantity": 0 }, "DefaultRootObject": "index.html", "Origins": { "Quantity": 1, "Items": [ { "Id": "amzn-s3-demo-bucket.s3.amazonaws.com-1574382155-273939", "DomainName": "amzn-s3-demo-bucket.s3.amazonaws.com", "OriginPath": "", "CustomHeaders": { "Quantity": 0 }, "S3OriginConfig": { "OriginAccessIdentity": "" } } ] }, "OriginGroups": { "Quantity": 0 }, "DefaultCacheBehavior": { "TargetOriginId": "amzn-s3-demo-bucket.s3.amazonaws.com-1574382155-273939", "ForwardedValues": { "QueryString": false, "Cookies": { "Forward": "none" }, "Headers": { "Quantity": 0 }, "QueryStringCacheKeys": { "Quantity": 0 } }, "TrustedSigners": { "Enabled": false, "Quantity": 0 }, "ViewerProtocolPolicy": "allow-all", "MinTTL": 0, "AllowedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ], "CachedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ] } }, "SmoothStreaming": false, "DefaultTTL": 86400, "MaxTTL": 31536000, "Compress": false, "LambdaFunctionAssociations": { "Quantity": 0 }, "FieldLevelEncryptionId": "" }, "CacheBehaviors": { "Quantity": 0 }, "CustomErrorResponses": { "Quantity": 0 }, "Comment": "", "Logging": { "Enabled": false, "IncludeCookies": false, "Bucket": "", "Prefix": "" }, "PriceClass": "PriceClass_All", "Enabled": false, "ViewerCertificate": { "CloudFrontDefaultCertificate": true, "MinimumProtocolVersion": "TLSv1", "CertificateSource": "cloudfront" }, "Restrictions": { "GeoRestriction": { "RestrictionType": "none", "Quantity": 0 } }, "WebACLId": "", "HttpVersion": "http2", "IsIPV6Enabled": true }
Saída:
{ "ETag": "E9LHASXEXAMPLE", "Distribution": { "Id": "EMLARXS9EXAMPLE", "ARN": "arn:aws:cloudfront::123456789012:distribution/EMLARXS9EXAMPLE", "Status": "InProgress", "LastModifiedTime": "2019-12-06T18:32:35.553Z", "InProgressInvalidationBatches": 0, "DomainName": "d111111abcdef8.cloudfront.net", "ActiveTrustedSigners": { "Enabled": false, "Quantity": 0 }, "DistributionConfig": { "CallerReference": "cli-1574382155-496510", "Aliases": { "Quantity": 0 }, "DefaultRootObject": "index.html", "Origins": { "Quantity": 1, "Items": [ { "Id": "amzn-s3-demo-bucket.s3.amazonaws.com-1574382155-273939", "DomainName": "amzn-s3-demo-bucket.s3.amazonaws.com", "OriginPath": "", "CustomHeaders": { "Quantity": 0 }, "S3OriginConfig": { "OriginAccessIdentity": "" } } ] }, "OriginGroups": { "Quantity": 0 }, "DefaultCacheBehavior": { "TargetOriginId": "amzn-s3-demo-bucket.s3.amazonaws.com-1574382155-273939", "ForwardedValues": { "QueryString": false, "Cookies": { "Forward": "none" }, "Headers": { "Quantity": 0 }, "QueryStringCacheKeys": { "Quantity": 0 } }, "TrustedSigners": { "Enabled": false, "Quantity": 0 }, "ViewerProtocolPolicy": "allow-all", "MinTTL": 0, "AllowedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ], "CachedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ] } }, "SmoothStreaming": false, "DefaultTTL": 86400, "MaxTTL": 31536000, "Compress": false, "LambdaFunctionAssociations": { "Quantity": 0 }, "FieldLevelEncryptionId": "" }, "CacheBehaviors": { "Quantity": 0 }, "CustomErrorResponses": { "Quantity": 0 }, "Comment": "", "Logging": { "Enabled": false, "IncludeCookies": false, "Bucket": "", "Prefix": "" }, "PriceClass": "PriceClass_All", "Enabled": false, "ViewerCertificate": { "CloudFrontDefaultCertificate": true, "MinimumProtocolVersion": "TLSv1", "CertificateSource": "cloudfront" }, "Restrictions": { "GeoRestriction": { "RestrictionType": "none", "Quantity": 0 } }, "WebACLId": "", "HttpVersion": "http2", "IsIPV6Enabled": true } } }
-
Para obter detalhes da API, consulte UpdateDistribution
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar update-field-level-encryption-config
.
- AWS CLI
-
Para atualizar uma configuração de criptografia no nível de campo do CloudFront
O exemplo a seguir atualiza o campo
Comment
da configuração de criptografia no nível de campo com o IDC3KM2WVD605UAY
fornecendo os parâmetros em um arquivo JSON.Para atualizar uma configuração de criptografia no nível de campo, você deve ter o ID da configuração e a
ETag
. O ID é retornado na saída dos comandos create-field-level-encryption-config e list-field-level-encryption-configs. Para obter aETag
, use o comando get-field-level-encryption ou get-field-level-encryption-config. Use a opção--if-match
para fornecer aETag
das configurações.aws cloudfront update-field-level-encryption-config \ --id
C3KM2WVD605UAY
\ --if-matchE2P4Z4VU7TY5SG
\ --field-level-encryption-configfile://fle-config.json
O arquivo
fle-config.json
é um documento JSON no diretório atual que contém o seguinte:{ "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" } ] } } }
Saída:
{ "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" } ] } } } } }
-
Para ver detalhes da API, consulte UpdateFieldLevelEncryptionConfig
na Referência de comandos da AWS CLI.
-
O código de exemplo a seguir mostra como usar update-field-level-encryption-profile
.
- AWS CLI
-
Para atualizar um perfil de criptografia no nível de campo do CloudFront
O exemplo a seguir atualiza o perfil de criptografia no nível de campo com o ID
PPK0UOSIF5WSV
. Este exemplo atualiza oName
e oComment
do perfil e adiciona um segundo itemFieldPatterns
, fornecendo os parâmetros em um arquivo JSON.Para atualizar um perfil de criptografia no nível de campo, você deve ter o ID e a
ETag
do perfil. O ID é retornado na saída dos comandos create-field-level-encryption-profile e list-field-level-encryption-profiles. Para obter aETag
, use o comando get-field-level-encryption-profile ou get-field-level-encryption-profile-config. Use a opção--if-match
para fornecer aETag
do perfil.aws cloudfront update-field-level-encryption-profile \ --id
PPK0UOSIF5WSV
\ --if-matchE1QQG65FS2L2GC
\ --field-level-encryption-profile-configfile://fle-profile-config.json
O arquivo
fle-profile-config.json
é um documento JSON no diretório atual que contém o seguinte:{ "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" ] } } ] } }
Saída:
{ "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" ] } } ] } } } }
-
Para ver detalhes da API, consulte UpdateFieldLevelEncryptionProfile
na Referência de comandos da AWS CLI.
-