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.
Gunakan DescribeImageAttribute
dengan CLI
Contoh kode berikut menunjukkan cara menggunakanDescribeImageAttribute
.
- CLI
-
- AWS CLI
-
Untuk menjelaskan izin peluncuran untuk AMI
Contoh ini menjelaskan izin peluncuran untuk AMI yang ditentukan.
Perintah:
aws ec2 describe-image-attribute --image-id
ami-5731123e
--attributelaunchPermission
Output:
{ "LaunchPermissions": [ { "UserId": "123456789012" } ], "ImageId": "ami-5731123e", }
Untuk mendeskripsikan kode produk untuk AMI
Contoh ini menjelaskan kode produk untuk AMI yang ditentukan. Perhatikan bahwa AMI ini tidak memiliki kode produk.
Perintah:
aws ec2 describe-image-attribute --image-id
ami-5731123e
--attributeproductCodes
Output:
{ "ProductCodes": [], "ImageId": "ami-5731123e", }
-
Untuk detail API, lihat DescribeImageAttribute
di Referensi AWS CLI Perintah.
-
- PowerShell
-
- Alat untuk PowerShell
-
Contoh 1: Contoh ini mendapatkan deskripsi untuk AMI yang ditentukan.
Get-EC2ImageAttribute -ImageId ami-12345678 -Attribute description
Output:
BlockDeviceMappings : {} Description : My image description ImageId : ami-12345678 KernelId : LaunchPermissions : {} ProductCodes : {} RamdiskId : SriovNetSupport :
Contoh 2: Contoh ini mendapatkan izin peluncuran untuk AMI yang ditentukan.
Get-EC2ImageAttribute -ImageId ami-12345678 -Attribute launchPermission
Output:
BlockDeviceMappings : {} Description : ImageId : ami-12345678 KernelId : LaunchPermissions : {all} ProductCodes : {} RamdiskId : SriovNetSupport :
Contoh 3: Contoh ini menguji apakah jaringan yang ditingkatkan diaktifkan.
Get-EC2ImageAttribute -ImageId ami-12345678 -Attribute sriovNetSupport
Output:
BlockDeviceMappings : {} Description : ImageId : ami-12345678 KernelId : LaunchPermissions : {} ProductCodes : {} RamdiskId : SriovNetSupport : simple
-
Untuk detail API, lihat DescribeImageAttributedi Referensi Alat AWS untuk PowerShell Cmdlet.
-