Ada lebih banyak contoh AWS SDK yang tersedia di repo Contoh SDK AWS Doc
Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
CloudFront contoh menggunakan AWS CLI
Contoh kode berikut menunjukkan cara melakukan tindakan dan mengimplementasikan skenario umum dengan menggunakan AWS Command Line Interface with CloudFront.
Tindakan adalah kutipan kode dari program yang lebih besar dan harus dijalankan dalam konteks. Sementara tindakan menunjukkan cara memanggil fungsi layanan individual, Anda dapat melihat tindakan dalam konteks dalam skenario terkait.
Setiap contoh menyertakan tautan ke kode sumber lengkap, di mana Anda dapat menemukan instruksi tentang cara mengatur dan menjalankan kode dalam konteks.
Topik
Tindakan
Contoh kode berikut menunjukkan cara menggunakancreate-cloud-front-origin-access-identity
.
- AWS CLI
-
Untuk membuat identitas akses CloudFront asal
Contoh berikut membuat identitas akses CloudFront asal (OAI) dengan menyediakan konfigurasi OAI sebagai argumen baris perintah:
aws cloudfront create-cloud-front-origin-access-identity \ --cloud-front-origin-access-identity-config \ CallerReference="cli-example",Comment="Example OAI"
Anda dapat mencapai hal yang sama dengan menyediakan konfigurasi OAI dalam file JSON, seperti yang ditunjukkan pada contoh berikut:
aws cloudfront create-cloud-front-origin-access-identity \ --cloud-front-origin-access-identity-config
file://OAI-config.json
File tersebut
OAI-config.json
adalah dokumen JSON di direktori saat ini yang berisi berikut ini:{ "CallerReference": "cli-example", "Comment": "Example OAI" }
Apakah Anda memberikan konfigurasi OAI dengan argumen baris perintah atau file JSON, outputnya sama:
{ "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" } } }
-
Untuk detail API, lihat CreateCloudFrontOriginAccessIdentity
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-distribution-with-tags
.
- AWS CLI
-
Untuk membuat CloudFront distribusi dengan tag
create-distribution-with-tags
Contoh berikut membuat distribusi dengan dua tag dengan menyediakan konfigurasi distribusi dan tag dalam file JSON bernamadist-config-with-tags.json
.aws cloudfront create-distribution-with-tags \ --distribution-config-with-tags
file://dist-config-with-tags.json
File tersebut
dist-config-with-tags.json
adalah dokumen JSON di folder saat ini. PerhatikanTags
objek di bagian atas file, yang berisi dua tag:Name = ExampleDistribution
Project = ExampleProject
Isi dari
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.goskope.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.rproxy.goskope.com-cli-example", "ForwardedValues": { "QueryString": false, "Cookies": { "Forward": "none" }, "Headers": { "Quantity": 0 }, "QueryStringCacheKeys": { "Quantity": 0 } }, "TrustedSigners": { "Enabled": false, "Quantity": 0 }, "ViewerProtocolPolicy": "allow-all", "MinTTL": 0, "AllowedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ], "CachedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ] } }, "SmoothStreaming": false, "DefaultTTL": 86400, "MaxTTL": 31536000, "Compress": false, "LambdaFunctionAssociations": { "Quantity": 0 }, "FieldLevelEncryptionId": "" }, "CacheBehaviors": { "Quantity": 0 }, "CustomErrorResponses": { "Quantity": 0 }, "Comment": "", "Logging": { "Enabled": false, "IncludeCookies": false, "Bucket": "", "Prefix": "" }, "PriceClass": "PriceClass_All", "Enabled": true, "ViewerCertificate": { "CloudFrontDefaultCertificate": true, "MinimumProtocolVersion": "TLSv1", "CertificateSource": "cloudfront" }, "Restrictions": { "GeoRestriction": { "RestrictionType": "none", "Quantity": 0 } }, "WebACLId": "", "HttpVersion": "http2", "IsIPV6Enabled": true } }
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.goskope.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.rproxy.goskope.com-cli-example", "ForwardedValues": { "QueryString": false, "Cookies": { "Forward": "none" }, "Headers": { "Quantity": 0 }, "QueryStringCacheKeys": { "Quantity": 0 } }, "TrustedSigners": { "Enabled": false, "Quantity": 0 }, "ViewerProtocolPolicy": "allow-all", "MinTTL": 0, "AllowedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ], "CachedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ] } }, "SmoothStreaming": false, "DefaultTTL": 86400, "MaxTTL": 31536000, "Compress": false, "LambdaFunctionAssociations": { "Quantity": 0 }, "FieldLevelEncryptionId": "" }, "CacheBehaviors": { "Quantity": 0 }, "CustomErrorResponses": { "Quantity": 0 }, "Comment": "", "Logging": { "Enabled": false, "IncludeCookies": false, "Bucket": "", "Prefix": "" }, "PriceClass": "PriceClass_All", "Enabled": true, "ViewerCertificate": { "CloudFrontDefaultCertificate": true, "MinimumProtocolVersion": "TLSv1", "CertificateSource": "cloudfront" }, "Restrictions": { "GeoRestriction": { "RestrictionType": "none", "Quantity": 0 } }, "WebACLId": "", "HttpVersion": "http2", "IsIPV6Enabled": true } } }
-
Untuk detail API, lihat CreateDistributionWithTags
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-distribution
.
- AWS CLI
-
Contoh 1: Untuk membuat CloudFront distribusi
Contoh berikut membuat distribusi untuk bucket S3 bernama
amzn-s3-demo-bucket
, dan juga menentukanindex.html
sebagai objek root default, menggunakan argumen baris perintah.aws cloudfront create-distribution \ --origin-domain-name
amzn-s3-demo-bucket.s3.amazonaws.com
\ --default-root-objectindex.html
Output:
{ "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.goskope.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.rproxy.goskope.com-cli-example", "ForwardedValues": { "QueryString": false, "Cookies": { "Forward": "none" }, "Headers": { "Quantity": 0 }, "QueryStringCacheKeys": { "Quantity": 0 } }, "TrustedSigners": { "Enabled": false, "Quantity": 0 }, "ViewerProtocolPolicy": "allow-all", "MinTTL": 0, "AllowedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ], "CachedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ] } }, "SmoothStreaming": false, "DefaultTTL": 86400, "MaxTTL": 31536000, "Compress": false, "LambdaFunctionAssociations": { "Quantity": 0 }, "FieldLevelEncryptionId": "" }, "CacheBehaviors": { "Quantity": 0 }, "CustomErrorResponses": { "Quantity": 0 }, "Comment": "", "Logging": { "Enabled": false, "IncludeCookies": false, "Bucket": "", "Prefix": "" }, "PriceClass": "PriceClass_All", "Enabled": true, "ViewerCertificate": { "CloudFrontDefaultCertificate": true, "MinimumProtocolVersion": "TLSv1", "CertificateSource": "cloudfront" }, "Restrictions": { "GeoRestriction": { "RestrictionType": "none", "Quantity": 0 } }, "WebACLId": "", "HttpVersion": "http2", "IsIPV6Enabled": true } } }
Contoh 2: Untuk membuat CloudFront distribusi menggunakan file JSON
Contoh berikut membuat distribusi untuk bucket S3 bernama
amzn-s3-demo-bucket
, dan juga menentukanindex.html
sebagai objek root default, menggunakan file JSON.aws cloudfront create-distribution \ --distribution-config
file://dist-config.json
Isi dari
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.goskope.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.rproxy.goskope.com-cli-example", "ForwardedValues": { "QueryString": false, "Cookies": { "Forward": "none" }, "Headers": { "Quantity": 0 }, "QueryStringCacheKeys": { "Quantity": 0 } }, "TrustedSigners": { "Enabled": false, "Quantity": 0 }, "ViewerProtocolPolicy": "allow-all", "MinTTL": 0, "AllowedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ], "CachedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ] } }, "SmoothStreaming": false, "DefaultTTL": 86400, "MaxTTL": 31536000, "Compress": false, "LambdaFunctionAssociations": { "Quantity": 0 }, "FieldLevelEncryptionId": "" }, "CacheBehaviors": { "Quantity": 0 }, "CustomErrorResponses": { "Quantity": 0 }, "Comment": "", "Logging": { "Enabled": false, "IncludeCookies": false, "Bucket": "", "Prefix": "" }, "PriceClass": "PriceClass_All", "Enabled": true, "ViewerCertificate": { "CloudFrontDefaultCertificate": true, "MinimumProtocolVersion": "TLSv1", "CertificateSource": "cloudfront" }, "Restrictions": { "GeoRestriction": { "RestrictionType": "none", "Quantity": 0 } }, "WebACLId": "", "HttpVersion": "http2", "IsIPV6Enabled": true }
Lihat Contoh 1 untuk keluaran sampel.
-
Untuk detail API, lihat CreateDistribution
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-field-level-encryption-config
.
- AWS CLI
-
Untuk membuat konfigurasi CloudFront enkripsi tingkat lapangan
Contoh berikut membuat konfigurasi enkripsi tingkat lapangan dengan menyediakan parameter konfigurasi dalam file JSON bernama.
fle-config.json
Sebelum Anda dapat membuat konfigurasi enkripsi tingkat lapangan, Anda harus memiliki profil enkripsi tingkat lapangan. Untuk membuat profil, lihat perintah create-field-level-encryption -profile.Untuk informasi selengkapnya tentang enkripsi CloudFront tingkat lapangan, lihat Menggunakan Enkripsi Tingkat Bidang untuk Membantu Melindungi Data Sensitif di Panduan Pengembang Amazon. CloudFront
aws cloudfront create-field-level-encryption-config \ --field-level-encryption-config
file://fle-config.json
File tersebut
fle-config.json
adalah dokumen JSON di folder saat ini yang berisi berikut ini:{ "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" } ] } } } } }
-
Untuk detail API, lihat CreateFieldLevelEncryptionConfig
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-field-level-encryption-profile
.
- AWS CLI
-
Untuk membuat profil CloudFront enkripsi tingkat lapangan
Contoh berikut membuat profil enkripsi tingkat lapangan dengan menyediakan parameter dalam file JSON bernama.
fle-profile-config.json
Sebelum Anda dapat membuat profil enkripsi tingkat lapangan, Anda harus memiliki CloudFront kunci publik. Untuk membuat kunci CloudFront publik, lihat create-public-key perintah.Untuk informasi selengkapnya tentang enkripsi CloudFront tingkat lapangan, lihat Menggunakan Enkripsi Tingkat Bidang untuk Membantu Melindungi Data Sensitif di Panduan Pengembang Amazon. CloudFront
aws cloudfront create-field-level-encryption-profile \ --field-level-encryption-profile-config
file://fle-profile-config.json
File tersebut
fle-profile-config.json
adalah dokumen JSON di folder saat ini yang berisi berikut ini:{ "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" ] } } ] } } } }
-
Untuk detail API, lihat CreateFieldLevelEncryptionProfile
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-invalidation
.
- AWS CLI
-
Untuk membuat pembatalan untuk distribusi CloudFront
create-invalidation
Contoh berikut membuat pembatalan untuk file tertentu dalam distribusi yang ditentukan CloudFront :aws cloudfront create-invalidation \ --distribution-id
EDFDVBD6EXAMPLE
\ --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" } } }
Pada contoh sebelumnya, AWS CLI secara otomatis menghasilkan acak.
CallerReference
Untuk menentukan sendiriCallerReference
, atau untuk menghindari meneruskan parameter pembatalan sebagai argumen baris perintah, Anda dapat menggunakan file JSON. Contoh berikut membuat pembatalan untuk dua file, dengan menyediakan parameter pembatalan dalam file JSON bernama:inv-batch.json
aws cloudfront create-invalidation \ --distribution-id
EDFDVBD6EXAMPLE
\ --invalidation-batchfile://inv-batch.json
Isi dari
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" } } }
-
Untuk detail API, lihat CreateInvalidation
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-public-key
.
- AWS CLI
-
Untuk membuat kunci CloudFront publik
Contoh berikut membuat kunci CloudFront publik dengan menyediakan parameter dalam file JSON bernama
pub-key-config.json
. Sebelum Anda dapat menggunakan perintah ini, Anda harus memiliki kunci publik yang dikodekan PEM. Untuk informasi selengkapnya, lihat Membuat Pasangan Kunci RSA di Panduan CloudFront Pengembang Amazon.aws cloudfront create-public-key \ --public-key-config
file://pub-key-config.json
File tersebut
pub-key-config.json
adalah dokumen JSON di folder saat ini yang berisi berikut ini. Perhatikan bahwa kunci publik dikodekan dalam format 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" } } }
-
Untuk detail API, lihat CreatePublicKey
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-cloud-front-origin-access-identity
.
- AWS CLI
-
Untuk menghapus identitas akses CloudFront asal
Contoh berikut menghapus identitas akses asal (OAI) dengan ID.
E74FTE3AEXAMPLE
Untuk menghapus OAI, Anda harus memiliki ID OAI dan.ETag
ID OAI dikembalikan dalam output perintah -access-identity dan create-cloud-front-origin -access-identities. list-cloud-front-origin Untuk mendapatkanETag
, gunakan perintah get-cloud-front-origin -access-identity atau get-cloud-front-origin -. access-identity-config Gunakan--if-match
opsi untuk menyediakan OAI.ETag
aws cloudfront delete-cloud-front-origin-access-identity \ --id
E74FTE3AEXAMPLE
\ --if-matchE2QWRUHEXAMPLE
Ketika berhasil, perintah ini tidak memiliki output.
-
Untuk detail API, lihat DeleteCloudFrontOriginAccessIdentity
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-distribution
.
- AWS CLI
-
Untuk menghapus CloudFront distribusi
Contoh berikut menghapus CloudFront distribusi dengan ID
EDFDVBD6EXAMPLE
. Sebelum Anda dapat menghapus distribusi, Anda harus menonaktifkannya. Untuk menonaktifkan distribusi, gunakan perintah pembaruan-distribusi. Untuk informasi selengkapnya, lihat contoh distribusi pembaruan.Ketika distribusi dinonaktifkan, Anda dapat menghapusnya. Untuk menghapus distribusi, Anda harus menggunakan
--if-match
opsi untuk menyediakan distribusiETag
. Untuk mendapatkanETag
, gunakan get-distribusi atau get-distribution-config perintah.aws cloudfront delete-distribution \ --id
EDFDVBD6EXAMPLE
\ --if-matchE2QWRUHEXAMPLE
Ketika berhasil, perintah ini tidak memiliki output.
-
Untuk detail API, lihat DeleteDistribution
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-field-level-encryption-config
.
- AWS CLI
-
Untuk menghapus konfigurasi CloudFront enkripsi tingkat lapangan
Contoh berikut menghapus konfigurasi enkripsi CloudFront tingkat lapangan dengan ID.
C3KM2WVD605UAY
Untuk menghapus konfigurasi enkripsi tingkat lapangan, Anda harus memiliki ID dan.ETag
ID dikembalikan dalam output perintah create-field-level-encryption -config dan list-field-level-encryption -configs. Untuk mendapatkanETag
, gunakan perintah get-field-level-encryption or get-field-level-encryption -config. Gunakan--if-match
opsi untuk menyediakan konfigurasiETag
.aws cloudfront delete-field-level-encryption-config \ --id
C3KM2WVD605UAY
\ --if-matchE26M4BIAV81ZF6
Ketika berhasil, perintah ini tidak memiliki output.
-
Untuk detail API, lihat DeleteFieldLevelEncryptionConfig
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-field-level-encryption-profile
.
- AWS CLI
-
Untuk menghapus profil CloudFront enkripsi tingkat lapangan
Contoh berikut menghapus profil enkripsi CloudFront tingkat lapangan dengan ID.
PPK0UOSIF5WSV
Untuk menghapus profil enkripsi tingkat lapangan, Anda harus memiliki ID dan.ETag
ID dikembalikan dalam output perintah create-field-level-encryption -profile dan list-field-level-encryption -profiles. Untuk mendapatkanETag
, gunakan perintah get-field-level-encryption -profile atau get-field-level-encryption -profile-config. Gunakan--if-match
opsi untuk menyediakan profilETag
.aws cloudfront delete-field-level-encryption-profile \ --id
PPK0UOSIF5WSV
\ --if-matchEJETYFJ9CL66D
Ketika berhasil, perintah ini tidak memiliki output.
-
Untuk detail API, lihat DeleteFieldLevelEncryptionProfile
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-public-key
.
- AWS CLI
-
Untuk menghapus kunci CloudFront publik
Contoh berikut menghapus kunci CloudFront publik dengan ID
KDFB19YGCR002
. Untuk menghapus kunci publik, Anda harus memiliki ID danETag
. ID dikembalikan dalam output list-public-keys perintah create-public-key dan. Untuk mendapatkanETag
, gunakan get-public-key-config perintah get-public-key or. Gunakan--if-match
opsi untuk menyediakan kunci publikETag
.aws cloudfront delete-public-key \ --id
KDFB19YGCR002
\ --if-matchE2QWRUHEXAMPLE
Ketika berhasil, perintah ini tidak memiliki output.
-
Untuk detail API, lihat DeletePublicKey
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-cloud-front-origin-access-identity-config
.
- AWS CLI
-
Untuk mendapatkan konfigurasi identitas akses CloudFront asal
Contoh berikut mendapatkan metadata tentang identitas akses CloudFront asal (OAI) dengan ID
E74FTE3AEXAMPLE
, termasuk nya.ETag
ID OAI dikembalikan dalam output perintah -access-identity dan create-cloud-front-origin -access-identities. list-cloud-front-originaws cloudfront get-cloud-front-origin-access-identity-config --id
E74FTE3AEXAMPLE
Output:
{ "ETag": "E2QWRUHEXAMPLE", "CloudFrontOriginAccessIdentityConfig": { "CallerReference": "cli-example", "Comment": "Example OAI" } }
-
Untuk detail API, lihat GetCloudFrontOriginAccessIdentityConfig
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-cloud-front-origin-access-identity
.
- AWS CLI
-
Untuk mendapatkan identitas akses CloudFront asal
Contoh berikut mendapatkan identitas akses CloudFront asal (OAI) dengan ID
E74FTE3AEXAMPLE
, termasuk ID kanonikETag
dan S3 terkait. ID OAI dikembalikan dalam output perintah -access-identity dan create-cloud-front-origin -access-identities. list-cloud-front-originaws cloudfront get-cloud-front-origin-access-identity --id
E74FTE3AEXAMPLE
Output:
{ "ETag": "E2QWRUHEXAMPLE", "CloudFrontOriginAccessIdentity": { "Id": "E74FTE3AEXAMPLE", "S3CanonicalUserId": "cd13868f797c227fbea2830611a26fe0a21ba1b826ab4bed9b7771c9aEXAMPLE", "CloudFrontOriginAccessIdentityConfig": { "CallerReference": "cli-example", "Comment": "Example OAI" } } }
-
Untuk detail API, lihat GetCloudFrontOriginAccessIdentity
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-distribution-config
.
- AWS CLI
-
Untuk mendapatkan konfigurasi CloudFront distribusi
Contoh berikut mendapatkan metadata tentang CloudFront distribusi dengan ID
EDFDVBD6EXAMPLE
, termasuk nya.ETag
ID distribusi dikembalikan dalam perintah create-distribution dan list-distributions.aws cloudfront get-distribution-config \ --id
EDFDVBD6EXAMPLE
Output:
{ "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.goskope.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.rproxy.goskope.com-cli-example", "ForwardedValues": { "QueryString": false, "Cookies": { "Forward": "none" }, "Headers": { "Quantity": 0 }, "QueryStringCacheKeys": { "Quantity": 0 } }, "TrustedSigners": { "Enabled": false, "Quantity": 0 }, "ViewerProtocolPolicy": "allow-all", "MinTTL": 0, "AllowedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ], "CachedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ] } }, "SmoothStreaming": false, "DefaultTTL": 86400, "MaxTTL": 31536000, "Compress": false, "LambdaFunctionAssociations": { "Quantity": 0 }, "FieldLevelEncryptionId": "" }, "CacheBehaviors": { "Quantity": 0 }, "CustomErrorResponses": { "Quantity": 0 }, "Comment": "", "Logging": { "Enabled": false, "IncludeCookies": false, "Bucket": "", "Prefix": "" }, "PriceClass": "PriceClass_All", "Enabled": true, "ViewerCertificate": { "CloudFrontDefaultCertificate": true, "MinimumProtocolVersion": "TLSv1", "CertificateSource": "cloudfront" }, "Restrictions": { "GeoRestriction": { "RestrictionType": "none", "Quantity": 0 } }, "WebACLId": "", "HttpVersion": "http2", "IsIPV6Enabled": true } }
-
Untuk detail API, lihat GetDistributionConfig
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-distribution
.
- AWS CLI
-
Untuk mendapatkan CloudFront distribusi
get-distribution
Contoh berikut mendapatkan CloudFront distribusi dengan IDEDFDVBD6EXAMPLE
, termasuk nyaETag
. ID distribusi dikembalikan dalam perintah create-distribution dan list-distributions.aws cloudfront get-distribution \ --id
EDFDVBD6EXAMPLE
Output:
{ "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.goskope.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.rproxy.goskope.com-cli-example", "ForwardedValues": { "QueryString": false, "Cookies": { "Forward": "none" }, "Headers": { "Quantity": 0 }, "QueryStringCacheKeys": { "Quantity": 0 } }, "TrustedSigners": { "Enabled": false, "Quantity": 0 }, "ViewerProtocolPolicy": "allow-all", "MinTTL": 0, "AllowedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ], "CachedMethods": { "Quantity": 2, "Items": [ "HEAD", "GET" ] } }, "SmoothStreaming": false, "DefaultTTL": 86400, "MaxTTL": 31536000, "Compress": false, "LambdaFunctionAssociations": { "Quantity": 0 }, "FieldLevelEncryptionId": "" }, "CacheBehaviors": { "Quantity": 0 }, "CustomErrorResponses": { "Quantity": 0 }, "Comment": "", "Logging": { "Enabled": false, "IncludeCookies": false, "Bucket": "", "Prefix": "" }, "PriceClass": "PriceClass_All", "Enabled": true, "ViewerCertificate": { "CloudFrontDefaultCertificate": true, "MinimumProtocolVersion": "TLSv1", "CertificateSource": "cloudfront" }, "Restrictions": { "GeoRestriction": { "RestrictionType": "none", "Quantity": 0 } }, "WebACLId": "", "HttpVersion": "http2", "IsIPV6Enabled": true } } }
-
Untuk detail API, lihat GetDistribution
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-field-level-encryption-config
.
- AWS CLI
-
Untuk mendapatkan metadata tentang konfigurasi enkripsi tingkat CloudFront lapangan
Contoh berikut mendapatkan metadata tentang konfigurasi enkripsi CloudFront tingkat lapangan dengan ID, termasuk:
C3KM2WVD605UAY
ETag
aws cloudfront get-field-level-encryption-config --id
C3KM2WVD605UAY
Output:
{ "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" } ] } } } }
-
Untuk detail API, lihat GetFieldLevelEncryptionConfig
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-field-level-encryption-profile-config
.
- AWS CLI
-
Untuk mendapatkan konfigurasi CloudFront profil enkripsi tingkat lapangan
Contoh berikut mendapatkan metadata tentang profil enkripsi CloudFront tingkat lapangan dengan ID, termasuk:
PPK0UOSIF5WSV
ETag
aws cloudfront get-field-level-encryption-profile-config --id
PPK0UOSIF5WSV
Output:
{ "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" ] } } ] } } }
-
Untuk detail API, lihat GetFieldLevelEncryptionProfileConfig
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-field-level-encryption-profile
.
- AWS CLI
-
Untuk mendapatkan profil CloudFront enkripsi tingkat lapangan
Contoh berikut mendapatkan profil enkripsi CloudFront tingkat lapangan dengan ID
PPK0UOSIF5WSV
, termasuk:ETag
aws cloudfront get-field-level-encryption-profile --id
PPK0UOSIF5WSV
Output:
{ "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" ] } } ] } } } }
-
Untuk detail API, lihat GetFieldLevelEncryptionProfile
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-field-level-encryption
.
- AWS CLI
-
Untuk mendapatkan konfigurasi CloudFront enkripsi tingkat lapangan
Contoh berikut mendapatkan konfigurasi enkripsi CloudFront tingkat lapangan dengan ID
C3KM2WVD605UAY
, termasuk:ETag
aws cloudfront get-field-level-encryption --id
C3KM2WVD605UAY
Output:
{ "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" } ] } } } } }
-
Untuk detail API, lihat GetFieldLevelEncryption
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-invalidation
.
- AWS CLI
-
Untuk mendapatkan CloudFront pembatalan
Contoh berikut mendapatkan pembatalan dengan ID
I2J0I21PCUYOIK
untuk CloudFront distribusi dengan ID:EDFDVBD6EXAMPLE
aws cloudfront get-invalidation --id
I2J0I21PCUYOIK
--distribution-idEDFDVBD6EXAMPLE
Output:
{ "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" } }
-
Untuk detail API, lihat GetInvalidation
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-public-key-config
.
- AWS CLI
-
Untuk mendapatkan konfigurasi kunci CloudFront publik
Contoh berikut mendapatkan metadata tentang kunci CloudFront publik dengan ID
KDFB19YGCR002
, termasuk nya.ETag
ID kunci publik dikembalikan dalam list-public-keys perintah create-public-key and.aws cloudfront get-public-key-config --id
KDFB19YGCR002
Output:
{ "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" } }
-
Untuk detail API, lihat GetPublicKeyConfig
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-public-key
.
- AWS CLI
-
Untuk mendapatkan kunci CloudFront publik
Contoh berikut mendapatkan kunci CloudFront publik dengan ID
KDFB19YGCR002
, termasuk nyaETag
. ID kunci publik dikembalikan dalam list-public-keys perintah create-public-key and.aws cloudfront get-public-key --id
KDFB19YGCR002
Output:
{ "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" } } }
-
Untuk detail API, lihat GetPublicKey
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-cloud-front-origin-access-identities
.
- AWS CLI
-
Untuk mencantumkan identitas akses CloudFront asal
Contoh berikut mendapatkan daftar identitas akses CloudFront asal (OAIs) di AWS akun Anda:
aws cloudfront list-cloud-front-origin-access-identities
Output:
{ "CloudFrontOriginAccessIdentityList": { "Items": [ { "Id": "E74FTE3AEXAMPLE", "S3CanonicalUserId": "cd13868f797c227fbea2830611a26fe0a21ba1b826ab4bed9b7771c9aEXAMPLE", "Comment": "Example OAI" }, { "Id": "EH1HDMBEXAMPLE", "S3CanonicalUserId": "1489f6f2e6faacaae7ff64c4c3e6956c24f78788abfc1718c3527c263bf7a17EXAMPLE", "Comment": "Test OAI" }, { "Id": "E2X2C9TEXAMPLE", "S3CanonicalUserId": "cbfeebb915a64749f9be546a45b3fcfd3a31c779673c13c4dd460911ae402c2EXAMPLE", "Comment": "Example OAI #2" } ] } }
-
Untuk detail API, lihat ListCloudFrontOriginAccessIdentities
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-distributions
.
- AWS CLI
-
Untuk daftar CloudFront distribusi
Contoh berikut mendapatkan daftar CloudFront distribusi di AWS akun Anda.
aws cloudfront list-distributions
Output:
{ "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 } ] } }
-
Untuk detail API, lihat ListDistributions
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-field-level-encryption-configs
.
- AWS CLI
-
Untuk membuat daftar konfigurasi CloudFront enkripsi tingkat lapangan
Contoh berikut mendapatkan daftar konfigurasi enkripsi CloudFront tingkat bidang di akun Anda: AWS
aws cloudfront list-field-level-encryption-configs
Output:
{ "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" } ] } } } ] } }
-
Untuk detail API, lihat ListFieldLevelEncryptionConfigs
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-field-level-encryption-profiles
.
- AWS CLI
-
Untuk membuat daftar profil CloudFront enkripsi tingkat lapangan
Contoh berikut mendapatkan daftar profil enkripsi CloudFront tingkat bidang di akun Anda: AWS
aws cloudfront list-field-level-encryption-profiles
Output:
{ "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" } ] } }
-
Untuk detail API, lihat ListFieldLevelEncryptionProfiles
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-invalidations
.
- AWS CLI
-
Untuk membuat daftar CloudFront pembatalan
Contoh berikut mendapatkan daftar pembatalan untuk CloudFront distribusi dengan ID:
EDFDVBD6EXAMPLE
aws cloudfront list-invalidations --distribution-id
EDFDVBD6EXAMPLE
Output:
{ "InvalidationList": { "Marker": "", "Items": [ { "Status": "Completed", "Id": "YNY2LI2BVJ4NJU", "CreateTime": "2019-08-31T21:15:52.042Z" } ], "IsTruncated": false, "MaxItems": 100, "Quantity": 1 } }
-
Untuk detail API, lihat ListInvalidations
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-public-keys
.
- AWS CLI
-
Untuk daftar kunci CloudFront publik
Contoh berikut mendapatkan daftar kunci CloudFront publik di AWS akun Anda:
aws cloudfront list-public-keys
Output:
{ "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" } ] } }
-
Untuk detail API, lihat ListPublicKeys
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-tags-for-resource
.
- AWS CLI
-
Untuk daftar tag untuk CloudFront distribusi
Contoh berikut mendapat daftar tag untuk CloudFront distribusi:
aws cloudfront list-tags-for-resource \ --resource
arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE
Output:
{ "Tags": { "Items": [ { "Key": "DateCreated", "Value": "2019-12-04" }, { "Key": "Name", "Value": "Example name" }, { "Key": "Project", "Value": "Example project" } ] } }
-
Untuk detail API, lihat ListTagsForResource
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakansign
.
- AWS CLI
-
Untuk menandatangani CloudFront URL
Contoh berikut menandatangani CloudFront URL. Untuk menandatangani URL, Anda memerlukan ID key pair (disebut ID Kunci Akses di Konsol AWS Manajemen) dan kunci pribadi dari CloudFront key pair penandatangan tepercaya. Untuk informasi selengkapnya tentang ditandatangani URLs, lihat Menyajikan Konten Pribadi dengan Cookie yang Ditandatangani URLs dan Ditandatangani di Panduan CloudFront Pengembang Amazon.
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
Output:
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
-
Untuk detail API, lihat Referensi AWS CLI Perintah Masuk
.
-
Contoh kode berikut menunjukkan cara menggunakantag-resource
.
- AWS CLI
-
Untuk menandai CloudFront distribusi
tag-resource
Contoh berikut menambahkan dua tag ke CloudFront distribusi yang ditentukan.aws cloudfront tag-resource \ --resource
arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE
\ --tags 'Items=[{Key=Name,Value="Example name"},{Key=Project,Value="Example project"}]
'Alih-alih menggunakan argumen baris perintah, Anda dapat memberikan tag dalam file JSON, seperti yang ditunjukkan pada contoh berikut:
aws cloudfront tag-resource \ --resource
arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE
\ --tagsfile://tags.json
Isi dari
tags.json
:{ "Items": [ { "Key": "Name", "Value": "Example name" }, { "Key": "Project", "Value": "Example project" } ] }
Perintah ini tidak menghasilkan output.
-
Untuk detail API, lihat TagResource
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanuntag-resource
.
- AWS CLI
-
Untuk menghapus tag dari CloudFront distribusi
Contoh berikut menghapus dua tag dari CloudFront distribusi dengan menggunakan argumen baris perintah:
aws cloudfront untag-resource \ --resource
arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE
\ --tag-keysItems=Name,Project
Alih-alih menggunakan argumen baris perintah, Anda dapat memberikan kunci tag dalam file JSON, seperti yang ditunjukkan pada contoh berikut:
aws cloudfront untag-resource \ --resource
arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE
\ --tag-keysfile://tag-keys.json
File tersebut
tag-keys.json
adalah dokumen JSON di folder saat ini yang berisi berikut ini:{ "Items": [ "Name", "Project" ] }
Ketika berhasil, perintah ini tidak memiliki output.
-
Untuk detail API, lihat UntagResource
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-cloud-front-origin-access-identity
.
- AWS CLI
-
Untuk memperbarui identitas akses CloudFront asal
Contoh berikut memperbarui identitas akses asal (OAI) dengan ID
E74FTE3AEXAMPLE
. Satu-satunya bidang yang dapat Anda perbarui adalah OAI.Comment
Untuk memperbarui OAI, Anda harus memiliki ID OAI dan.
ETag
ID OAI dikembalikan dalam output perintah -access-identity dan create-cloud-front-origin -access-identities. list-cloud-front-origin Untuk mendapatkanETag
, gunakan perintah get-cloud-front-origin -access-identity atau get-cloud-front-origin -. access-identity-config Gunakan--if-match
opsi untuk menyediakan OAI.ETag
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"Anda dapat mencapai hal yang sama dengan menyediakan konfigurasi OAI dalam file JSON, seperti yang ditunjukkan pada contoh berikut:
aws cloudfront update-cloud-front-origin-access-identity \ --id
E74FTE3AEXAMPLE
\ --if-matchE2QWRUHEXAMPLE
\ --cloud-front-origin-access-identity-configfile://OAI-config.json
File tersebut
OAI-config.json
adalah dokumen JSON di direktori saat ini yang berisi berikut ini:{ "CallerReference": "cli-example", "Comment": "Example OAI Updated" }
Apakah Anda memberikan konfigurasi OAI dengan argumen baris perintah atau file JSON, outputnya sama:
{ "ETag": "E9LHASXEXAMPLE", "CloudFrontOriginAccessIdentity": { "Id": "E74FTE3AEXAMPLE", "S3CanonicalUserId": "cd13868f797c227fbea2830611a26fe0a21ba1b826ab4bed9b7771c9aEXAMPLE", "CloudFrontOriginAccessIdentityConfig": { "CallerReference": "cli-example", "Comment": "Example OAI Updated" } } }
-
Untuk detail API, lihat UpdateCloudFrontOriginAccessIdentity
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-distribution
.
- AWS CLI
-
Contoh 1: Untuk memperbarui objek root default CloudFront distribusi
Contoh berikut memperbarui objek root default
index.html
untuk CloudFront distribusi dengan IDEDFDVBD6EXAMPLE
.aws cloudfront update-distribution \ --id
EDFDVBD6EXAMPLE
\ --default-root-objectindex.html
Output:
{ "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 } } }
Contoh 2: Untuk memperbarui CloudFront distribusi
Contoh berikut menonaktifkan CloudFront distribusi dengan ID
EMLARXS9EXAMPLE
dengan menyediakan konfigurasi distribusi dalam file JSON bernama.dist-config-disable.json
Untuk memperbarui distribusi, Anda harus menggunakan--if-match
opsi untuk menyediakan distribusiETag
. Untuk mendapatkanETag
, gunakan get-distribusi atau get-distribution-config perintah. Perhatikan bahwaEnabled
bidang diatur kefalse
dalam file JSON.Setelah Anda menggunakan contoh berikut untuk menonaktifkan distribusi, Anda dapat menggunakan perintah hapus-distribusi untuk menghapusnya.
aws cloudfront update-distribution \ --id
EMLARXS9EXAMPLE
\ --if-matchE2QWRUHEXAMPLE
\ --distribution-configfile://dist-config-disable.json
Isi dari
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.goskope.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.rproxy.goskope.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 }
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.goskope.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.rproxy.goskope.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 } } }
-
Untuk detail API, lihat UpdateDistribution
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-field-level-encryption-config
.
- AWS CLI
-
Untuk memperbarui konfigurasi CloudFront enkripsi tingkat lapangan
Contoh berikut memperbarui
Comment
bidang konfigurasi enkripsi tingkat lapangan dengan IDC3KM2WVD605UAY
dengan menyediakan parameter dalam file JSON.Untuk memperbarui konfigurasi enkripsi tingkat lapangan, Anda harus memiliki ID konfigurasi dan.
ETag
ID dikembalikan dalam output perintah create-field-level-encryption -config dan list-field-level-encryption -configs. Untuk mendapatkanETag
, gunakan perintah get-field-level-encryption or get-field-level-encryption -config. Gunakan--if-match
opsi untuk menyediakan konfigurasiETag
.aws cloudfront update-field-level-encryption-config \ --id
C3KM2WVD605UAY
\ --if-matchE2P4Z4VU7TY5SG
\ --field-level-encryption-configfile://fle-config.json
File tersebut
fle-config.json
adalah dokumen JSON di direktori saat ini yang berisi berikut ini:{ "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" } ] } } } } }
-
Untuk detail API, lihat UpdateFieldLevelEncryptionConfig
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-field-level-encryption-profile
.
- AWS CLI
-
Untuk memperbarui profil CloudFront enkripsi tingkat lapangan
Contoh berikut memperbarui profil enkripsi tingkat lapangan dengan ID.
PPK0UOSIF5WSV
Contoh ini memperbarui profilName
danComment
, dan menambahkanFieldPatterns
item kedua, dengan menyediakan parameter dalam file JSON.Untuk memperbarui profil enkripsi tingkat lapangan, Anda harus memiliki ID profil dan.
ETag
ID dikembalikan dalam output perintah create-field-level-encryption -profile dan list-field-level-encryption -profiles. Untuk mendapatkanETag
, gunakan perintah get-field-level-encryption -profile atau get-field-level-encryption -profile-config. Gunakan--if-match
opsi untuk menyediakan profilETag
.aws cloudfront update-field-level-encryption-profile \ --id
PPK0UOSIF5WSV
\ --if-matchE1QQG65FS2L2GC
\ --field-level-encryption-profile-configfile://fle-profile-config.json
File tersebut
fle-profile-config.json
adalah dokumen JSON di direktori saat ini yang berisi berikut ini:{ "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" ] } } ] } } } }
-
Untuk detail API, lihat UpdateFieldLevelEncryptionProfile
di Referensi AWS CLI Perintah.
-