

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

有关重大更改和迁移应用程序的信息，请参阅[迁移主题](https://docs.aws.amazon.com/powershell/v5/userguide/migrating-v5.html)。

 [https://docs.aws.amazon.com/powershell/v5/userguide/migrating-v5.html](https://docs.aws.amazon.com/powershell/v5/userguide/migrating-v5.html)

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

# AWS 价目表 使用适用于 PowerShell V5 的工具的示例
<a name="powershell_pricing_code_examples"></a>

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

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

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

**Topics**
+ [操作](#actions)

## 操作
<a name="actions"></a>

### `Get-PLSAttributeValue`
<a name="pricing_GetAttributeValues_powershell_topic"></a>

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

**适用于 PowerShell V5 的工具**  
**示例 1：返回 us-east-1 区域的亚马逊属性 “VolumeType” EC2 的值。**  

```
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](https://docs.aws.amazon.com/powershell/v5/reference)中的。

### `Get-PLSProduct`
<a name="pricing_GetProducts_powershell_topic"></a>

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

**适用于 PowerShell V5 的工具**  
**示例 1：亚马逊所有商品的退货详情 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：返回亚马逊 EC2 在 us-east-1 地区的数据，这些数据按支持 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](https://docs.aws.amazon.com/powershell/v5/reference)中的。

### `Get-PLSService`
<a name="pricing_DescribeServices_powershell_topic"></a>

以下代码示例演示了如何使用 `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 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](https://docs.aws.amazon.com/powershell/v5/reference)中的。