

Doc AWS SDK 예제 GitHub 리포지토리에서 더 많은 SDK 예제를 사용할 수 있습니다. [AWS](https://github.com/awsdocs/aws-doc-sdk-examples) 

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# AWS SDKs AWS 가격표 사용에 대한 코드 예제
<a name="pricing_code_examples"></a>

다음 코드 예제에서는 AWS 소프트웨어 개발 키트(SDK)와 AWS 가격표 함께를 사용하는 방법을 보여줍니다.

*작업*은 대규모 프로그램에서 발췌한 코드이며 컨텍스트에 맞춰 실행해야 합니다. 작업은 개별 서비스 함수를 직접 호출하는 방법을 보여주며, 관련 시나리오의 컨텍스트에 맞는 작업을 볼 수 있습니다.

**추가 리소스**
+  **[AWS 가격표 사용 설명서](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/price-changes.html)** -에 대한 자세한 정보입니다 AWS 가격표.
+ **[AWS 가격표 API 참조](https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/Welcome.html)** - 사용 가능한 모든 AWS 가격표 작업에 대한 세부 정보입니다.
+ **[AWS 개발자 센터](https://aws.amazon.com/developer/code-examples/?awsf.sdk-code-examples-product=product%23)** - 범주 또는 전체 텍스트 검색을 기준으로 필터링할 수 있는 코드 예제입니다.
+ **[AWS SDK 예제](https://github.com/awsdocs/aws-doc-sdk-examples)** - 기본 설정 언어로 된 전체 코드가 포함된 GitHub 리포지토리. 코드 설정 및 실행을 위한 지침이 포함되어 있습니다.

**Contents**
+ [기본 사항](pricing_code_examples_basics.md)
  + [작업](pricing_code_examples_actions.md)
    + [`DescribeServices`](pricing_example_pricing_DescribeServices_section.md)
    + [`GetAttributeValues`](pricing_example_pricing_GetAttributeValues_section.md)
    + [`GetProducts`](pricing_example_pricing_GetProducts_section.md)

# AWS SDKs AWS 가격표 사용에 대한 기본 예제
<a name="pricing_code_examples_basics"></a>

다음 코드 예제에서는 AWS 가격표 SDKs에서의 기본 사항을 AWS 사용하는 방법을 보여줍니다.

**Contents**
+ [작업](pricing_code_examples_actions.md)
  + [`DescribeServices`](pricing_example_pricing_DescribeServices_section.md)
  + [`GetAttributeValues`](pricing_example_pricing_GetAttributeValues_section.md)
  + [`GetProducts`](pricing_example_pricing_GetProducts_section.md)

# AWS SDKs AWS 가격표 를 사용하기 위한 작업
<a name="pricing_code_examples_actions"></a>

다음 코드 예제에서는 AWS SDKs를 사용하여 개별 AWS 가격표 작업을 수행하는 방법을 보여줍니다. 각 예시에는 GitHub에 대한 링크가 포함되어 있습니다. 여기에서 코드 설정 및 실행에 대한 지침을 찾을 수 있습니다.

 다음 예제에는 가장 일반적으로 사용되는 작업만 포함되어 있습니다. 전체 목록은 [AWS 가격표 API 참조](https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/Welcome.html)를 참조하세요.

**Topics**
+ [`DescribeServices`](pricing_example_pricing_DescribeServices_section.md)
+ [`GetAttributeValues`](pricing_example_pricing_GetAttributeValues_section.md)
+ [`GetProducts`](pricing_example_pricing_GetProducts_section.md)

# CLI로 `DescribeServices` 사용
<a name="pricing_example_pricing_DescribeServices_section"></a>

다음 코드 예시는 `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](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pricing/describe-services.html)를 참조하세요.

------
#### [ 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 참조(V4)*의 [DescribeServices](https://docs.aws.amazon.com/powershell/v4/reference)를 참조하세요.

**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 참조(V5)*의 [DescribeServices](https://docs.aws.amazon.com/powershell/v5/reference)를 참조하세요.

------

# CLI로 `GetAttributeValues` 사용
<a name="pricing_example_pricing_GetAttributeValues_section"></a>

다음 코드 예시는 `GetAttributeValues`의 사용 방법을 보여 줍니다.

------
#### [ CLI ]

**AWS CLI**  
**속성 값 목록 가져오기**  
다음 `get-attribute-values` 예시에서는 지정된 속성에 사용할 수 있는 값 목록을 가져옵니다.  

```
aws pricing get-attribute-values \
    --service-code AmazonEC2 \
    --attribute-name volumeType \
    --max-items 2
```
출력:  

```
{
    "NextToken": "eyJOZXh0VG9rZW4iOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAyfQ==",
    "AttributeValues": [
        {
            "Value": "Cold HDD"
        },
        {
            "Value": "General Purpose"
        }
    ]
}
```
+  API 세부 정보는 *AWS CLI 명령 참조*의 [GetAttributeValues](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pricing/get-attribute-values.html)를 참조하세요.

------
#### [ PowerShell ]

**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 Cmdlet 참조(V4)*의 [GetAttributeValues](https://docs.aws.amazon.com/powershell/v4/reference)를 참조하세요.

**Tools for 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 참조(V5)*의 [GetAttributeValues](https://docs.aws.amazon.com/powershell/v5/reference)를 참조하세요.

------

# CLI로 `GetProducts` 사용
<a name="pricing_example_pricing_GetProducts_section"></a>

다음 코드 예시는 `GetProducts`의 사용 방법을 보여 줍니다.

------
#### [ CLI ]

**AWS CLI**  
**제품 목록 가져오기**  
이 예시에서는 지정된 기준과 일치하는 제품 목록을 가져옵니다.  
명령:  

```
aws pricing get-products --filters file://filters.json --format-version aws_v1 --max-results 1 --service-code AmazonEC2
```
filter.json:  

```
        [
  {
    "Type": "TERM_MATCH",
    "Field": "ServiceCode",
    "Value": "AmazonEC2"
  },
  {
    "Type": "TERM_MATCH",
    "Field": "volumeType",
    "Value": "Provisioned IOPS"
  }
]
```
출력:  

```
{
  "FormatVersion": "aws_v1",
  "NextToken": "WGDY7ko8fQXdlaUZVdasFQ==:RVSagyIFn770XQOzdUIcO9BY6ucBG9itXAZGZF/zioUzOsUKh6PCcPWaOyPZRiMePb986TeoKYB9l55fw/CyoMq5ymnGmT1Vj39TljbbAlhcqnVfTmPIilx8Uy5bdDaBYy/e/2Ofw9Edzsykbs8LTBuNbiDQ+BBds5yeI9AQkUepruKk3aEahFPxJ55kx/zk",
  "PriceList": [
      "{\"product\":{\"productFamily\":\"Storage\",\"attributes\":{\"storageMedia\":\"SSD-backed\",\"maxThroughputvolume\":\"320 MB/sec\",\"volumeType\":\"Provisioned IOPS\",\"maxIopsvolume\":\"20000\",\"servicecode\":\"AmazonEC2\",\"usagetype\":\"APS1-EBS:VolumeUsage.piops\",\"locationType\":\"AWS Region\",\"location\":\"Asia Pacific (Singapore)\",\"servicename\":\"Amazon Elastic Compute Cloud\",\"maxVolumeSize\":\"16 TiB\",\"operation\":\"\"},\"sku\":\"3MKHN58N7RDDVGKJ\"},\"serviceCode\":\"AmazonEC2\",\"terms\":{\"OnDemand\":{\"3MKHN58N7RDDVGKJ.JRTCKXETXF\":{\"priceDimensions\":{\"3MKHN58N7RDDVGKJ.JRTCKXETXF.6YS6EN2CT7\":{\"unit\":\"GB-Mo\",\"endRange\":\"Inf\",\"description\":\"$0.138 per GB-month of Provisioned IOPS SSD (io1)  provisioned storage - Asia Pacific (Singapore)\",\"appliesTo\":[],\"rateCode\":\"3MKHN58N7RDDVGKJ.JRTCKXETXF.6YS6EN2CT7\",\"beginRange\":\"0\",\"pricePerUnit\":{\"USD\":\"0.1380000000\"}}},\"sku\":\"3MKHN58N7RDDVGKJ\",\"effectiveDate\":\"2018-08-01T00:00:00Z\",\"offerTermCode\":\"JRTCKXETXF\",\"termAttributes\":{}}}},\"version\":\"20180808005701\",\"publicationDate\":\"2018-08-08T00:57:01Z\"}"
  ]
}
```
+  API 세부 정보는 *AWS CLI 명령 참조*의 [GetProducts](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pricing/get-products.html)를 참조하세요.

------
#### [ PowerShell ]

**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: SSD 지원 'General Purpose' 볼륨 유형으로 필터링된 us-east-1 리전의 Amazon EC2에 대한 데이터를 반환합니다.**  

```
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 참조(V4)*의 [GetProducts](https://docs.aws.amazon.com/powershell/v4/reference)를 참조하세요.

**Tools for 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: SSD 지원 'General Purpose' 볼륨 유형으로 필터링된 us-east-1 리전의 Amazon EC2에 대한 데이터를 반환합니다.**  

```
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 참조(V5)*의 [GetProducts](https://docs.aws.amazon.com/powershell/v5/reference)를 참조하세요.

------