AWS 文档 AWS SDK示例 GitHub 存储库中还有更多SDK示例
本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
DescribeServices
与 a 一起使用 CLI
以下代码示例演示如何使用 DescribeServices
。
- CLI
-
- AWS CLI
-
检索服务元数据
此示例检索 Amazon EC2 服务代码的元数据。
命令:
aws pricing describe-services --service-code
AmazonEC2
--format-versionaws_v1
--max-items1
输出:
{ "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详细信息,请参阅 “DescribeServices AWS CLI
命令参考”。
-
- PowerShell
-
- 用于 PowerShell
-
示例 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 EC2 区域中亚马逊服务的元数据。
Get-PLSService -ServiceCode AmazonEC2 -Region us-east-1
输出:
AttributeNames ServiceCode -------------- ----------- {volumeType, maxIopsvolume, instanceCapacity10xlarge, locationType...} AmazonEC2
-
有关API详细信息,请参阅 AWS Tools for PowerShell Cmdlet 参考DescribeServices中的。
-
操作
GetAttributeValues