View a markdown version of this page

AWS 价目表 使用适用于 PowerShell V5 的工具的示例 - AWS Tools for PowerShell (版本 5)

的版本 5 (V5) AWS Tools for PowerShell 已经发布!

有关重大更改和迁移应用程序的信息,请参阅迁移主题

Orange button with text "Click here for details".

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

AWS 价目表 使用适用于 PowerShell V5 的工具的示例

以下代码示例向您展示了如何使用带 AWS 价目表的 AWS Tools for PowerShell V5 来执行操作和实现常见场景。

操作是大型程序的代码摘录,必须在上下文中运行。您可以通过操作了解如何调用单个服务函数,还可以通过函数相关场景的上下文查看操作。

每个示例都包含一个指向完整源代码的链接,您可以从中找到有关如何在上下文中设置和运行代码的说明。

主题

操作

以下代码示例演示了如何使用 Get-PLSAttributeValue

适用于 PowerShell V5 的工具

示例 1:返回 us-east-1 区域中 Amazon EC2 的属性“volumeType”的值。

Get-PLSAttributeValue -ServiceCode AmazonEC2 -AttributeName "volumeType" -region us-east-1

输出

Value ----- Cold HDD General Purpose Magnetic Provisioned IOPS Throughput Optimized HDD
  • 有关 API 的详细信息,请参阅 AWS Tools for PowerShell Cmdlet 参考 (V 5) GetAttributeValues中的。

以下代码示例演示了如何使用 Get-PLSProduct

适用于 PowerShell V5 的工具

示例 1:返回 Amazon EC2 的所有产品的详细信息。

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

输出

{"product":{"productFamily":"Compute Instance","attributes":{"enhancedNetworkingSupported":"Yes","memory":"30.5 GiB","dedicatedEbsThroughput":"800 Mbps","vcpu":"4","locationType":"AWS Region","storage":"EBS only","instanceFamily":"Memory optimized","operatingSystem":"SUSE","physicalProcessor":"Intel Xeon E5-2686 v4 (Broadwell)","clockSpeed":"2.3 GHz","ecu":"Variable","networkPerformance":"Up to 10 Gigabit","servicename":"Amazon Elastic Compute Cloud","instanceType":"r4.xlarge","tenancy":"Shared","usagetype":"USW2-BoxUsage:r4.xlarge","normalizationSizeFactor":"8","processorFeatures":"Intel AVX, Intel AVX2, Intel Turbo","servicecode":"AmazonEC2","licenseModel":"No License required","currentGeneration":"Yes","preInstalledSw":"NA","location":"US West (Oregon)","processorArchitecture":"64-bit","operation":"RunInstances:000g"},...

示例 2:返回 us-east-1 区域中 Amazon EC2 的数据,这些数据按支持 SSD 的“通用型”卷类型进行筛选。

Get-PLSProduct -ServiceCode AmazonEC2 -Filter @{Type="TERM_MATCH";Field="volumeType";Value="General Purpose"},@{Type="TERM_MATCH";Field="storageMedia";Value="SSD-backed"} -Region us-east-1

输出

{"product":{"productFamily":"Storage","attributes":{"storageMedia":"SSD-backed","maxThroughputvolume":"160 MB/sec","volumeType":"General Purpose","maxIopsvolume":"10000",...
  • 有关 API 的详细信息,请参阅 AWS Tools for PowerShell Cmdlet 参考 (V 5) GetProducts中的。

以下代码示例演示了如何使用 Get-PLSService

适用于 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 参考 (V 5) DescribeServices中的。