Gunakan DescribeServices dengan CLI - AWS Contoh Kode SDK

Ada lebih banyak contoh AWS SDK yang tersedia di repo Contoh SDK AWS Doc. GitHub

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

Gunakan DescribeServices dengan CLI

Contoh kode berikut menunjukkan cara menggunakanDescribeServices.

CLI
AWS CLI

Untuk mengambil metadata layanan

Contoh ini mengambil metadata untuk kode layanan Amazon EC2 .

Perintah:

aws pricing describe-services --service-code AmazonEC2 --format-version aws_v1 --max-items 1

Output:

{ "Services": [ { "ServiceCode": "AmazonEC2", "AttributeNames": [ "volumeType", "maxIopsvolume", "instance", "instanceCapacity10xlarge", "locationType", "instanceFamily", "operatingSystem", "clockSpeed", "LeaseContractLength", "ecu", "networkPerformance", "instanceCapacity8xlarge", "group", "maxThroughputvolume", "gpuMemory", "ebsOptimized", "elasticGpuType", "maxVolumeSize", "gpu", "processorFeatures", "intelAvxAvailable", "instanceCapacity4xlarge", "servicecode", "groupDescription", "processorArchitecture", "physicalCores", "productFamily", "enhancedNetworkingSupported", "intelTurboAvailable", "memory", "dedicatedEbsThroughput", "vcpu", "OfferingClass", "instanceCapacityLarge", "capacitystatus", "termType", "storage", "intelAvx2Available", "storageMedia", "physicalProcessor", "provisioned", "servicename", "PurchaseOption", "instanceCapacity18xlarge", "instanceType", "tenancy", "usagetype", "normalizationSizeFactor", "instanceCapacity2xlarge", "instanceCapacity16xlarge", "maxIopsBurstPerformance", "instanceCapacity12xlarge", "instanceCapacity32xlarge", "instanceCapacityXlarge", "licenseModel", "currentGeneration", "preInstalledSw", "location", "instanceCapacity24xlarge", "instanceCapacity9xlarge", "instanceCapacityMedium", "operation" ] } ], "FormatVersion": "aws_v1" }
PowerShell
Alat untuk PowerShell V4

Contoh 1: Mengembalikan metadata untuk semua kode layanan yang tersedia di wilayah us-east-1.

Get-PLSService -Region us-east-1

Output:

AttributeNames ServiceCode -------------- ----------- {productFamily, servicecode, groupDescription, termType...} AWSBudgets {productFamily, servicecode, termType, usagetype...} AWSCloudTrail {productFamily, servicecode, termType, usagetype...} AWSCodeCommit {productFamily, servicecode, termType, usagetype...} AWSCodeDeploy {productFamily, servicecode, termType, usagetype...} AWSCodePipeline {productFamily, servicecode, termType, usagetype...} AWSConfig ...

Contoh 2: Mengembalikan metadata untuk EC2 layanan Amazon di wilayah us-east-1.

Get-PLSService -ServiceCode AmazonEC2 -Region us-east-1

Output:

AttributeNames ServiceCode -------------- ----------- {volumeType, maxIopsvolume, instanceCapacity10xlarge, locationType...} AmazonEC2
  • Untuk detail API, lihat DescribeServicesdi Referensi Alat AWS untuk PowerShell Cmdlet (V4).

Alat untuk PowerShell V5

Contoh 1: Mengembalikan metadata untuk semua kode layanan yang tersedia di wilayah us-east-1.

Get-PLSService -Region us-east-1

Output:

AttributeNames ServiceCode -------------- ----------- {productFamily, servicecode, groupDescription, termType...} AWSBudgets {productFamily, servicecode, termType, usagetype...} AWSCloudTrail {productFamily, servicecode, termType, usagetype...} AWSCodeCommit {productFamily, servicecode, termType, usagetype...} AWSCodeDeploy {productFamily, servicecode, termType, usagetype...} AWSCodePipeline {productFamily, servicecode, termType, usagetype...} AWSConfig ...

Contoh 2: Mengembalikan metadata untuk EC2 layanan Amazon di wilayah us-east-1.

Get-PLSService -ServiceCode AmazonEC2 -Region us-east-1

Output:

AttributeNames ServiceCode -------------- ----------- {volumeType, maxIopsvolume, instanceCapacity10xlarge, locationType...} AmazonEC2
  • Untuk detail API, lihat DescribeServicesdi Referensi Alat AWS untuk PowerShell Cmdlet (V5).