

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

# Amazon OpenSearch Service のリザーブドインスタンス
<a name="ri"></a>

Amazon OpenSearch Service のリザーブドインスタンス (RI) では、標準オンデマンドインスタンスと比べて大幅な割引を受けられます。インスタンス自体は同一です。RI は、アカウントでのオンデマンドインスタンスに適用される請求の割引にすぎません。使用状況が予想可能な存続時間の長いアプリケーションについては、RI により時間の経過と共に大幅なコスト削減が可能になります。

OpenSearch Service RI には 1 年または 3 年の期間が必要で、割引レートに影響を与える 3 つのお支払い方法があります。
+ **前払いなし** – 前払いはありません。期間内の時間ごとに割引された時間料金を支払います。
+ **一部前払い** – 料金の一部を前払いし、期間内の時間ごとに割引された時間料金を支払います。
+ **全前払い** – 料金を全額前払いします。期間内に時間料金は支払いません。

一般的に、前払い料金が多いほど割引率がなくなります。リザーブドインスタンスをキャンセルすることはできず (予約するときに、全期間に対して支払う契約を結びます)、前払い料金は払い戻しできません。

RI は柔軟ではなく、予約したインスタンスタイプにのみ適用されます。例えば、8 個の `c5.2xlarge.search` インスタンスのための予約は、16 個の `c5.xlarge.search` インスタンスまたは 4 個の `c5.4xlarge.search` インスタンスには適用されません。ただし、 の組織の一部であるリンクされたアカウント AWS Organizations は、インスタンスタイプ、リージョン、ファミリー、サイズが一致する限り、RI の所有アカウントから未使用の割引アプリケーションを利用できます。詳細については、「[Amazon OpenSearch Service の料金](https://aws.amazon.com/elasticsearch-service/pricing/)」と「[よくある質問](https://aws.amazon.com/elasticsearch-service/faqs/)」を参照してください。

# リザーブドインスタンスの購入 (コンソール)
<a name="ri-console"></a>

コンソールでは、既存のリザーブドインスタンスを表示したり、新しいリザーブドインスタンスを購入したりできます。

**予約を購入するには**

1. [https://aws.amazon.com](https://aws.amazon.com/) にアクセスし、[**コンソールにサインイン**] を選択します。

1. **[分析]** の下で、**[Amazon OpenSearch Service]** を選択します。

1. ナビゲーションペインで [**リザーブドインスタンスのリース**] を選択します。

   このページでは、既存の予約を見ることができます。多くの予約がある場合、フィルタリングして特定の予約を識別して見やすくすることができます。
**ヒント**  
[**リザーブドインスタンスのリース**] リンクが表示されない場合は、 AWS リージョンで[ドメインを作成します](createupdatedomains.md)。

1. [**リザーブドインスタンスの注文**] を選択します。

1. 一意のわかりやすい名前を指定します。

1. インスタンスタイプ、サイズ、およびインスタンスの数を選択します。ガイダンスについては、「[Amazon OpenSearch Service ドメインのサイジング](sizing-domains.md)」を参照してください。

1. 期間の長さと支払いオプションを選択します。支払いの詳細を慎重に確認します。

1. [**次へ**] を選択します。

1. 購入概要を慎重に確認します。リザーブドインスタンスの購入は払い戻しできません。

1. [**注文**] を選択します。

# リザーブドインスタンスの購入 (AWS CLI)
<a name="ri-cli"></a>

 AWS CLI には、サービスの表示、予約の購入、予約の表示を行うためのコマンドがあります。次のコマンドとサンプルレスポンスは、特定の のサービスを示しています AWS リージョン。

```
aws opensearch describe-reserved-instance-offerings --region us-east-1
{
  "ReservedInstanceOfferings": [
    {
      "FixedPrice": x,
      "ReservedInstanceOfferingId": "1a2a3a4a5-1a2a-3a4a-5a6a-1a2a3a4a5a6a",
      "RecurringCharges": [
        {
          "RecurringChargeAmount": y,
          "RecurringChargeFrequency": "Hourly"
        }
      ],
      "UsagePrice": 0.0,
      "PaymentOption": "PARTIAL_UPFRONT",
      "Duration": 31536000,
      "InstanceType": "m4.2xlarge.search",
      "CurrencyCode": "USD"
    }
  ]
}
```

各戻り値の説明については、次の表を参照してください。


****  

| フィールド | 説明 | 
| --- | --- | 
| FixedPrice | 予約の前払いコスト。 | 
| ReservedInstanceOfferingId | 提供 ID。製品を予約する場合は、この値をメモしておきます。 | 
| RecurringCharges | 予約の時間料金。 | 
| UsagePrice | レガシーフィールド。OpenSearch Service では、この値は常に 0 です。 | 
| PaymentOption | 前払いなし、一部前払い、または全額前払い。 | 
| Duration | 期間の長さ (秒)。[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/opensearch-service/latest/developerguide/ri-cli.html) | 
| InstanceType | 予約のインスタンスタイプ。各インスタンスタイプに割り当てられるハードウェアリソースについては、「[Amazon OpenSearch Service の料金表](https://aws.amazon.com/elasticsearch-service/pricing/)」を参照してください。 | 
| CurrencyCode | FixedPrice と RecurringChargeAmount の通貨。 | 

この次の例では、予約を購入します。

```
aws opensearch purchase-reserved-instance-offering --reserved-instance-offering-id 1a2a3a4a5-1a2a-3a4a-5a6a-1a2a3a4a5a6a --reservation-name my-reservation --instance-count 3 --region us-east-1
{
  "ReservationName": "my-reservation",
  "ReservedInstanceId": "9a8a7a6a-5a4a-3a2a-1a0a-9a8a7a6a5a4a"
}
```

最後に、以下の例を使用して特定のリージョンの予約をリストできます。

```
aws opensearch describe-reserved-instances --region us-east-1
{
  "ReservedInstances": [
    {
      "FixedPrice": x,
      "ReservedInstanceOfferingId": "1a2a3a4a5-1a2a-3a4a-5a6a-1a2a3a4a5a6a",
      "ReservationName": "my-reservation",
      "PaymentOption": "PARTIAL_UPFRONT",
      "UsagePrice": 0.0,
      "ReservedInstanceId": "9a8a7a6a-5a4a-3a2a-1a0a-9a8a7a6a5a4a",
      "RecurringCharges": [
        {
          "RecurringChargeAmount": y,
          "RecurringChargeFrequency": "Hourly"
        }
      ],
      "State": "payment-pending",
      "StartTime": 1522872571.229,
      "InstanceCount": 3,
      "Duration": 31536000,
      "InstanceType": "m4.2xlarge.search",
      "CurrencyCode": "USD"
    }
  ]
}
```

**注記**  
`StartTime` は Unix エポック時間 (1970 年 1 月 1 日の午前 00:00 UTC から経過した秒数)。たとえば、1522872571 エポック時間は 2018 年 4 月 4 日の 20:09:31 UTC です。オンラインコンバーターを使用することができます。

前の例で使用されているコマンドの詳細については、[AWS CLI コマンドリファレンス](https://docs.aws.amazon.com/cli/latest/reference/es/index.html)を参照してください。

# リザーブドインスタンス (AWS SDKsの購入
<a name="ri-sdk"></a>

 AWS SDKs (Android および iOS SDKs を除く) は、[Amazon OpenSearch Service API リファレンス](https://docs.aws.amazon.com/opensearch-service/latest/APIReference/Welcome.html)で定義されている、以下を含むすべてのオペレーションをサポートします。
+ `DescribeReservedInstanceOfferings`
+ `PurchaseReservedInstanceOffering`
+ `DescribeReservedInstances`

このサンプルスクリプトは、 の [OpenSearchService](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/opensearch.html) 低レベル Python クライアント AWS SDK for Python (Boto3) を使用してリザーブドインスタンスを購入します。`instance_type` の値を指定する必要があります。

```
import boto3
from botocore.config import Config

# Build the client using the default credential configuration.
# You can use the CLI and run 'aws configure' to set access key, secret
# key, and default region.

my_config = Config(
    # Optionally lets you specify a region other than your default.
    region_name='us-east-1'
)

client = boto3.client('opensearch', config=my_config)

instance_type = '' # e.g. m4.2xlarge.search


def describe_RI_offerings(client):
    """Gets the Reserved Instance offerings for this account"""

    response = client.describe_reserved_instance_offerings()
    offerings = (response['ReservedInstanceOfferings'])
    return offerings


def check_instance(offering):
    """Returns True if instance type is the one you specified above"""

    if offering['InstanceType'] == instance_type:
        return True

    return False


def get_instance_id():
    """Iterates through the available offerings to find the ID of the one you specified"""

    instance_type_iterator = filter(
        check_instance, describe_RI_offerings(client))
    offering = list(instance_type_iterator)
    id = offering[0]['ReservedInstanceOfferingId']
    return id


def purchase_RI_offering(client):
    """Purchase Reserved Instances"""

    response = client.purchase_reserved_instance_offering(
        ReservedInstanceOfferingId = get_instance_id(),
        ReservationName = 'my-reservation',
        InstanceCount = 1
    )
    print('Purchased reserved instance offering of type ' + instance_type)
    print(response)


def main():
    """Purchase Reserved Instances"""
    purchase_RI_offering(client)
```

 AWS SDKs[AWS 「 Software Development Kits](https://aws.amazon.com/code)」を参照してください。

## コストを確認する
<a name="ri-ce"></a>

Cost Explorer は、過去 13 か月間の使用量データを表示できる無料のツールです。このデータを分析すると、傾向を見分けて、RI がユースケースに合うかどうかを理解できます。既に RI がある場合、[**購入オプション**] によって[グループ分け](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/groupdata.html)し、[償却コストを表示](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/advanced.html)してその使用量とオンデマンドインスタンスの使用量を比較できます。また、[使用状況の予算](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/budgets-managing-costs.html)を設定して、予約を活用していることを確認することもできます。詳細については、*AWS Billing ユーザーガイド*の「[Cost Explorer によるコストの分析](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-explorer-what-is.html)」を参照してください。