将 DescribeServices 与 CLI 配合使用 - AWS SDK 代码示例

AWS 文档 SDK 示例 GitHub 存储库中还有更多 AWS SDK 示例。

DescribeServices 与 CLI 配合使用

以下代码示例演示如何使用 DescribeServices

CLI
AWS CLI

检索服务元数据

此示例检索 Amazon EC2 服务代码的元数据。

命令:

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

输出:

{ "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" }
  • 有关 API 详细信息,请参阅《AWS CLI 命令参考》中的 DescribeServices

PowerShell
Tools for PowerShell V4

示例 1:返回 us-east-1 区域中所有可用服务代码的元数据。

Get-PLSService -Region us-east-1

输出

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 ...

示例 2:返回 us-east-1 区域中 Amazon EC2 服务的元数据。

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

输出

AttributeNames ServiceCode -------------- ----------- {volumeType, maxIopsvolume, instanceCapacity10xlarge, locationType...} AmazonEC2
  • 有关 API 详细信息,请参阅《AWS Tools for PowerShell Cmdlet Reference (V4)》中的 DescribeServices

Tools for PowerShell V5

示例 1:返回 us-east-1 区域中所有可用服务代码的元数据。

Get-PLSService -Region us-east-1

输出

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 ...

示例 2:返回 us-east-1 区域中 Amazon EC2 服务的元数据。

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

输出

AttributeNames ServiceCode -------------- ----------- {volumeType, maxIopsvolume, instanceCapacity10xlarge, locationType...} AmazonEC2
  • 有关 API 详细信息,请参阅《AWS Tools for PowerShell Cmdlet Reference (V5)》中的 DescribeServices