

Doc AWS SDK Examples GitHub リポジトリには、他にも SDK の例があります。 [AWS](https://github.com/awsdocs/aws-doc-sdk-examples)

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# AWS の料金表 Tools for PowerShell V4 を使用した の例
<a name="powershell_4_pricing_code_examples"></a>

次のコード例は、 で AWS Tools for PowerShell V4 を使用してアクションを実行し、一般的なシナリオを実装する方法を示しています AWS の料金表。

*アクション*はより大きなプログラムからのコードの抜粋であり、コンテキスト内で実行する必要があります。アクションは個々のサービス機能を呼び出す方法を示していますが、コンテキスト内のアクションは、関連するシナリオで確認できます。

各例には完全なソースコードへのリンクが含まれており、コードの設定方法と実行方法に関する手順を確認できます。

**Topics**
+ [アクション](#actions)

## アクション
<a name="actions"></a>

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

次のコード例は、`Get-PLSAttributeValue` を使用する方法を示しています。

**Tools for PowerShell V4**  
**例 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 コマンドレットリファレンス (V4)* の「[GetAttributeValues](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

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

次のコード例は、`Get-PLSProduct` を使用する方法を示しています。

**Tools for PowerShell V4**  
**例 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 ベースの「General Purpose」のボリュームタイプでフィルタリングされたデータを返します。**  

```
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 コマンドレットリファレンス (V4)* の「[GetProducts](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

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

次のコード例は、`Get-PLSService` を使用する方法を示しています。

**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 コマンドレットリファレンス (V4)* の「[DescribeServices](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。