Utilizzare DescribeServices con una CLI - Esempi di codice per SDK AWS

Sono disponibili altri esempi per SDK AWS nel repository GitHub della documentazione degli esempi per SDK AWS.

Utilizzare DescribeServices con una CLI

Gli esempi di codice seguenti mostrano come utilizzare DescribeServices.

CLI
AWS CLI

Come recuperare i metadati del servizio

Questo esempio recupera i metadati per il codice del servizio Amazon EC2.

Comando:

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" }
  • Per informazioni dettagliate sull’API, consulta DescribeServices nella documentazione di riferimento dei comandi della AWS CLI.

PowerShell
Strumenti per PowerShell V4

Esempio 1: restituisce i metadati per tutti i codici disponibili del servizio nella Regione 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 ...

Esempio 2: restituisce i metadati per il servizio Amazon EC2 nella Regione us-east-1.

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

Output:

AttributeNames ServiceCode -------------- ----------- {volumeType, maxIopsvolume, instanceCapacity10xlarge, locationType...} AmazonEC2
  • Per informazioni dettagliate sull’API, consulta DescribeServices nella documentazione di riferimento dei cmdlet di AWS Strumenti per PowerShell (V4).

Strumenti per PowerShell V5

Esempio 1: restituisce i metadati per tutti i codici disponibili del servizio nella Regione 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 ...

Esempio 2: restituisce i metadati per il servizio Amazon EC2 nella Regione us-east-1.

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

Output:

AttributeNames ServiceCode -------------- ----------- {volumeType, maxIopsvolume, instanceCapacity10xlarge, locationType...} AmazonEC2
  • Per informazioni dettagliate sull’API, consulta DescribeServices nella documentazione di riferimento dei cmdlet di AWS Strumenti per PowerShell (V5).