

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

# DR Orchestrator Framework を使用してクロスリージョンのフェイルオーバーとフェイルバックを自動化
<a name="automate-cross-region-failover-and-failback-by-using-dr-orchestrator-framework"></a>

*Amazon Web Services、Jitendra Kumar、Pavithra Balasubramanian、Oliver Francis*

## 概要
<a name="automate-cross-region-failover-and-failback-by-using-dr-orchestrator-framework-summary"></a>

本パターンでは、[DR Orchestrator Framework](https://docs.aws.amazon.com/prescriptive-guidance/latest/automate-dr-solution-relational-database/dr-orchestrator-framework-overview.html) を使用して、エラーが発生しやすい手動ステップをオーケストレーションおよび自動化し、Amazon Web Services (AWS) リージョン全体でディザスタリカバリを実行する方法について説明します。本パターンでは以下のデータベースがカバーされています。
+ Amazon Relational Database Service (Amazon RDS) for MySQL、Amazon RDS for PostgreSQL、または Amazon RDS for MariaDB
+ Amazon Aurora MySQL 互換エディションまたは Amazon Aurora PostgreSQL 互換エディション (一元化されたファイルを使用)
+ Amazon ElastiCache (Redis OSS)

DR Orchestrator Framework の機能を実際に使ってみるため、2 つの DB インスタンスまたはクラスターを作成します。プライマリは にあり AWS リージョン `us-east-1`、セカンダリは にあります`us-west-2`。これらのリソースを作成するには、[aws-cross-region-dr-databases](https://github.com/aws-samples/aws-cross-region-dr-databases) GitHub リポジトリの `App-Stack`フォルダにある AWS CloudFormation テンプレートを使用します。

## 前提条件と制限事項
<a name="automate-cross-region-failover-and-failback-by-using-dr-orchestrator-framework-prereqs"></a>

**一般的な前提条件**
+ プライマリとセカンダリの両方にデプロイされた DR オーケストレーターフレームワーク AWS リージョン
+ [Amazon Simple Storage Service](https://aws.amazon.com/s3/) バケット
+ 2 つのサブネットと AWS セキュリティグループを持つ [Virtual Private Cloud (VPC)](https://aws.amazon.com/vpc/) 

**エンジンに固有の前提条件**
+ **Amazon Aurora** – 少なくとも 1 つの Aurora グローバルデータベースを 2 つで利用できる必要があります AWS リージョン。`us-east-1` をプライマリリージョンとして、`us-west-2` をセカンダリリージョンとして使用できます。
+ **Amazon ElastiCache (Redis OSS)** – ElastiCache グローバルデータストアは 2 つで利用できる必要があります AWS リージョン。`use us-east-1` をプライマリリージョンとして、`us-west-2` をセカンダリリージョンとして使用できます。

**Amazon RDS の制限事項**
+ DR Orchestrator Framework は、フェイルオーバーまたはフェイルバックの実行前にレプリケーションラグをチェックしません。レプリケーションラグは手動でチェックする必要があります。
+ このソリューションは、1 つのリードレプリカを持つプライマリデータベースインスタンスを使用してテストされています。複数のリードレプリカを使用する場合は、本番環境に実装する前にソリューションを十分にテストします。

**Aurora の制限事項**
+ 機能の可用性とサポートは、各データベースエンジンの特定のバージョン、および AWS リージョンによって異なります。クロスリージョンレプリケーションの機能およびリージョンの可用性の詳細については、「[クロスリージョンリードレプリカ](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RDS_Fea_Regions_DB-eng.Feature.CrossRegionReadReplicas.html)」を参照してください。
+ Aurora グローバルデータベースには、サポートされている Aurora DB インスタンスクラスと の最大数に関する特定の設定要件があります AWS リージョン。詳細については、「[Amazon Aurora Global Database の構成要件](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-global-database-getting-started.html#aurora-global-database.configuration.requirements)」を参照してください。
+ このソリューションは、1 つのリードレプリカを持つプライマリデータベースインスタンスを使用してテストされています。複数のリードレプリカを使用する場合は、本番環境に実装する前にソリューションを十分にテストします。

**ElastiCache の制限事項**
+ Global Datastore と ElastiCache の設定要件のリージョンの可用性については、ElastiCache ドキュメントの「[前提条件と制限](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Redis-Global-Datastores-Getting-Started.html)」を参照してください。

**Amazon RDS** **製品バージョン**

Amazon RDS は、以下のエンジンバージョンをサポートしています。
+ **MySQL** – Amazon RDS は、[MySQL](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_MySQL.html) 8.0 および MySQL 5.7 バージョンを実行している DB インスタンスをサポートしています。
+ **PostgreSQL** – Amazon RDS for PostgreSQL のサポートされているバージョンについては、「[利用可能な PostgreSQL データベースバージョン](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_PostgreSQL.html#PostgreSQL.Concepts.General.DBVersions)」を参照してください。
+ **MariaDB** – は、以下のバージョンの [MariaDB](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_MariaDB.html) を実行する DB インスタンスをサポートしています。
  + MariaDB 10.11
  + MariaDB 10.6
  + MariaDB 10.5

**Aurora 製品バージョン**
+ MySQL 5.7 と互換性のある Aurora MySQL の場合、Amazon Aurora Global Database のスイッチオーバーにはバージョン 2.09.1 以降のマイナーバージョンが必要になります。

  詳細については、「[Amazon Aurora Global Database の制限](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-global-database.html#aurora-global-database.limitations)」を参照してください。

**ElastiCache (Redis OSS) 製品バージョン**

Amazon ElastiCache (Redis OSS) は、次の Redis バージョンをサポートしています。
+ Redis 7.1 (拡張)
+ Redis 7.0 (拡張)
+ Redis 6.2 (拡張)
+ Redis 6.0 (拡張)
+ Redis 5.0.6 (拡張)

詳細については、「[Supported ElastiCache (Redis OSS) version](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Redis-Global-Datastores-Getting-Started.html)」を参照してください。

## アーキテクチャ
<a name="automate-cross-region-failover-and-failback-by-using-dr-orchestrator-framework-architecture"></a>

**Amazon RDS** **アーキテクチャ**

Amazon RDS のアーキテクチャには、以下のリソースが含まれています。
+ クライアントの読み取り/書き込みアクセス権限を持つプライマリリージョン (`us-east-1`) で作成された、プライマリ Amazon RDS DB インスタンス
+ クライアントの読み取り専用アクセス権限を持つセカンダリリージョン (`us-west-2`) で作成された Amazon RDS リードレプリカ
+ プライマリとセカンダリ両方のリージョンにデプロイされた DR オーケストレーターフレームワーク

![1 つの AWS アカウントにある 2 つのリージョン RDS アーキテクチャの図。](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/images/pattern-img/8d39561f-924e-4b3e-8175-c5c3cab163bd/images/ad217033-600c-40da-929c-b9f9aecb4c2c.png)


図に示す内容は以下のとおりです。

1. プライマリインスタンスとセカンダリインスタンス間の非同期レプリケーション

1. プライマリリージョンのクライアントの読み取り/書き込みアクセス

1. セカンダリリージョンのクライアントの読み取り専用アクセス

**Aurora のアーキテクチャ**

Amazon Aurora のアーキテクチャには、以下のリソースが含まれています。
+ アクティブライターエンドポイントを使用してプライマリリージョン (`us-east-1`) で作成されたプライマリ Aurora DB クラスター
+ 非アクティブライターエンドポイントを持つセカンダリリージョン (`us-west-2`) で作成された Aurora DB クラスター
+ プライマリとセカンダリ両方のリージョンにデプロイされた DR オーケストレーターフレームワーク

![1 つの AWS アカウントにある 2 つのリージョンの Aurora デプロイの図。](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/images/pattern-img/8d39561f-924e-4b3e-8175-c5c3cab163bd/images/524ec002-5aa7-47b2-8c8d-6d1a3b535e9e.png)


図に示す内容は以下のとおりです。

1. プライマリクラスターとセカンダリクラスター間の非同期レプリケーション

1. アクティブライターエンドポイントを持つプライマリ DB クラスター

1. 非アクティブライターエンドポイントを持つセカンダリ DB クラスター

**ElastiCache (Redis OSS) のアーキテクチャ**

Amazon ElastiCache (Redis OSS) のアーキテクチャには以下のリソースが含まれています。
+ 2 つのクラスターで作成された ElastiCache (Redis OSS) グローバルデータストア

  1. プライマリリージョンのプライマリクラスター (`us-east-1`)

  1. セカンダリリージョン (`us-west-2`) のセカンダリクラスター
+ 2 つのクラスター間の TLS 1.2 暗号化を使用した Amazon クロスリージョンリンク
+ プライマリとセカンダリ両方のリージョンにデプロイされた DR オーケストレーターフレームワーク

![Amazon クロスリージョンリンクを使用した 2 つのリージョンの ElastiCache デプロイの図。](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/images/pattern-img/8d39561f-924e-4b3e-8175-c5c3cab163bd/images/cf6620a0-dd42-4042-8dc2-012bf514ffc0.png)


**自動化とスケール**

DR Orchestrator Framework はスケーラブルで、複数の AWS データベースのフェイルオーバーまたはフェイルバックを並行してサポートします。

次のペイロードコードを使用して、アカウント内の複数の AWS データベースをフェイルオーバーできます。この例では、3 つの AWS データベース (Aurora MySQL 互換または Aurora PostgreSQL 互換などの 2 つのグローバルデータベース、および 1 つの Amazon RDS for MySQL インスタンス) が DR リージョンにフェイルオーバーします。

```
{
  "StatePayload": [
    {
      "layer": 1,
      "resources": [
        {
          "resourceType": "PlannedFailoverAurora",
          "resourceName": "Switchover (planned failover) of Amazon Aurora global databases (MySQL)",
          "parameters": {
            "GlobalClusterIdentifier": "!Import dr-globaldb-cluster-mysql-global-identifier",
            "DBClusterIdentifier": "!Import dr-globaldb-cluster-mysql-cluster-identifier" 
          }
        },
        {
          "resourceType": "PlannedFailoverAurora",
          "resourceName": "Switchover (planned failover) of Amazon Aurora global databases (PostgreSQL)",
          "parameters": {
            "GlobalClusterIdentifier": "!Import dr-globaldb-cluster-postgres-global-identifier",
            "DBClusterIdentifier": "!Import dr-globaldb-cluster-postgres-cluster-identifier" 
          }
        },
        {
          "resourceType": "PromoteRDSReadReplica",
          "resourceName": "Promote RDS for MySQL Read Replica",
          "parameters": {
            "RDSInstanceIdentifier": "!Import rds-mysql-instance-identifier",
            "TargetClusterIdentifier": "!Import rds-mysql-instance-global-arn"
          }
        }         
      ]
    }
  ]
}
```

## ツール
<a name="automate-cross-region-failover-and-failback-by-using-dr-orchestrator-framework-tools"></a>

**AWS サービス**
+ 「[Amazon Aurora](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html)」はクラウド用に構築されたフルマネージド型のリレーショナルデータベースエンジンで、MySQL および PostgreSQL と互換性があります。
+ [Amazon ElastiCache](https://docs.aws.amazon.com/elasticache/) は、 AWS クラウドにある分散したインメモリキャッシュ環境のセットアップ、管理、スケールに役立ちます。このパターンでは、Amazon ElastiCache (Redis OSS) を使用します。
+ [AWS Lambda](https://aws.amazon.com/lambda/) は、サーバーのプロビジョニングや管理を行うことなくコードを実行できるコンピューティングサービスです。必要に応じてコードを実行し、自動的にスケーリングするため、課金は実際に使用したコンピューティング時間に対してのみ発生します。このパターンでは、Lambda 関数は AWS Step Functions によってステップの実行に使用されます。
+ [Amazon Relational Database Service (Amazon RDS)](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Welcome.html) を使用して、 AWS クラウドでリレーショナルデータベース (DB) をセットアップ、運用、スケーリングできます。このパターンは、Amazon RDS for MySQL、Amazon RDS for PostgreSQL、Amazon RDS for MariaDB をサポートしています。
+ [AWS SDK for Python (Boto3)](https://aws.amazon.com/sdk-for-python/) は、Python アプリケーション、ライブラリ、またはスクリプトを と統合するのに役立ちます AWS のサービス。このパターンでは、Boto3 API はデータベースインスタンスまたはグローバルデータベースとの通信に使用されます。
+ [AWS Step Functions](https://aws.amazon.com/step-functions/) は、 AWS Lambda 関数やその他の を組み合わせてビジネスクリティカルなアプリケーション AWS のサービス を構築するのに役立つサーバーレスオーケストレーションサービスです。このパターンでは、Step Functions ステートマシンを使用して、データベースインスタンスまたはグローバルデータベースの、クロスリージョンフェイルオーバーとフェイルバックをオーケストレーションして実行します。

**コードリポジトリ**

このパターンのコードは、GitHub の [aws-cross-region-dr-databases](https://github.com/aws-samples/aws-cross-region-dr-databases/tree/main/App-Stack) リポジトリで入手できます。

## エピック
<a name="automate-cross-region-failover-and-failback-by-using-dr-orchestrator-framework-epics"></a>

### DR オーケストレーターフレームワークをインストールする
<a name="install-dr-orchestrator-framework"></a>


| タスク | 説明 | 必要なスキル | 
| --- | --- | --- | 
| GitHub リポジトリのクローン作成 | リポジトリを複製するには、次のコマンドを実行します。<pre>git clone https://github.com/aws-samples/aws-cross-region-dr-databases.git</pre> | AWS DevOps、AWS 管理者 | 
| Lambda 関数コードを .zip ファイルアーカイブにパッケージ化します。 | Lambda 関数のアーカイブファイルを作成して、DR Orchestrator Framework の依存関係を含めます。<pre>cd <YOUR-LOCAL-GIT-FOLDER>/DR-Orchestration-artifacts<br /><br />bash scripts/deploy-orchestrator-sh.sh</pre> | AWS 管理者 | 
| S3 バケットを作成します。 | DR Orchestrator Framework を最新の設定で保存するには S3 バケットが必要です。2 つの S3 バケットを作成します。1 つはプライマリリージョン (`us-east-1`)、もう 1 つはセカンダリリージョン (`us-west-2`) です。[See the AWS documentation website for more details](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/automate-cross-region-failover-and-failback-by-using-dr-orchestrator-framework.html)<br />`xxxxxx` をランダムな値に置き換えて、バケット名を一意にします。 | AWS 管理者 | 
| サブネットとセキュリティグループを選択します。 | プライマリリージョン (`us-east-1`) とセカンダリリージョン (`us-west-2`) の両方で、VPC に Lambda 関数をデプロイするための 2 つのサブネットと 1 つのセキュリティグループを作成します。[See the AWS documentation website for more details](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/automate-cross-region-failover-and-failback-by-using-dr-orchestrator-framework.html) | AWS 管理者 | 
| DR Orchestrator のパラメータファイルを更新します。 | `<YOUR-LOCAL-GIT-FOLDER>/DR-Orchestration-artifacts/cloudformation` フォルダで、次の DR Orchestrator パラメータファイルを更新します。[See the AWS documentation website for more details](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/automate-cross-region-failover-and-failback-by-using-dr-orchestrator-framework.html)<br />次のパラメータ値を使用して、`x` と `y` をリソースの名前に置き換えます。<pre>[<br />    {<br />         "ParameterKey": "TemplateStoreS3BucketName",<br />         "ParameterValue": "dr-orchestrator-xxxxxx-us-east-1"<br />    },<br />    {<br />        "ParameterKey": "TemplateVPCId",<br />        "ParameterValue": "vpc-xxxxxx"<br />    },<br />    {<br />        "ParameterKey": "TemplateLambdaSubnetID1",<br />        "ParameterValue": "subnet-xxxxxx"<br />    },<br />    {<br />        "ParameterKey": "TemplateLambdaSubnetID2",<br />        "ParameterValue": "subnet-yyyyyy"<br />    },<br />    {<br />        "ParameterKey": "TemplateLambdaSecurityGroupID",<br />        "ParameterValue": "sg-xxxxxxxxxx"<br />    }<br /> ]</pre> | AWS 管理者 | 
| DR Orchestrator Framework コードを S3 バケットにアップロードします。 | このコードは、ローカルディレクトリよりも S3 バケットにアップロードする方が安全です。すべてのファイルとサブフォルダを含む `DR-Orchestration-artifacts` ディレクトリを S3 バケットにアップロードします。<br />コードをアップロードするには、次の操作を行います。[See the AWS documentation website for more details](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/automate-cross-region-failover-and-failback-by-using-dr-orchestrator-framework.html) | AWS 管理者 | 
| DR オーケストレーターフレームワークをプライマリリージョンにデプロイします。 | 次のコマンドを実行し、DR Orchestrator Framework をプライマリリージョン (`us-east-1`) にデプロイします。<pre>cd <YOUR-LOCAL-GIT-FOLDER>/DR-Orchestration-artifacts/cloudformation<br /><br />aws cloudformation deploy \<br />--region us-east-1 \<br />--stack-name dr-orchestrator \<br />--template-file Orchestrator-Deployer.yaml \<br />--parameter-overrides file://Orchestrator-Deployer-parameters-us-east-1.json \<br />--capabilities CAPABILITY_AUTO_EXPAND CAPABILITY_NAMED_IAM CAPABILITY_IAM \<br />--disable-rollback</pre> | AWS 管理者 | 
| DR Orchestrator Framework をセカンダリリージョンにデプロイします。 | セカンダリリージョン (`us-west-2`) で、次のコマンドを実行します。<pre>cd <YOUR-LOCAL-GIT-FOLDER>/DR-Orchestration-artifacts/cloudformation<br /><br />aws cloudformation deploy \<br />--region us-west-2 \<br />--stack-name dr-orchestrator \<br />--template-file Orchestrator-Deployer.yaml \<br />--parameter-overrides file://Orchestrator-Deployer-parameters-us-west-2.json \<br />--capabilities CAPABILITY_AUTO_EXPAND CAPABILITY_NAMED_IAM CAPABILITY_IAM \<br />--disable-rollback</pre> | AWS 管理者 | 
| デプロイメントを確認する。 |  CloudFormation コマンドが正常に実行されると、次の出力が返されます。<pre>Successfully created/updated stack - dr-orchestrator</pre><br />または、 CloudFormation コンソールに移動し、`dr-orchestrator`スタックのステータスを確認できます。 | AWS 管理者 | 

### データベースインスタンスまたはクラスターを作成する
<a name="create-the-database-instances-or-clusters"></a>


| タスク | 説明 | 必要なスキル | 
| --- | --- | --- | 
| データベースサブネットとセキュリティグループを作成します。 | VPC で、プライマリ (`us-east-1`) リージョンとセカンダリ (`us-west-2`) リージョンの両方に、DB インスタンスまたはグローバルデータベース用に 2 つのサブネットと 1 つのセキュリティグループを作成します。[See the AWS documentation website for more details](http://docs.aws.amazon.com/ja_jp/prescriptive-guidance/latest/patterns/automate-cross-region-failover-and-failback-by-using-dr-orchestrator-framework.html) | AWS 管理者 | 
| プライマリ DB インスタンスまたはクラスターの、パラメータファイルを更新します。 | `<YOUR LOCAL GIT FOLDER>/App-Stack` フォルダで、プライマリリージョンのパラメータファイルを更新します。<br />**Amazon RDS**<br />`RDS-MySQL-parameter-us-east-1.json` ファイルで、作成したリソースの名前を付けて `SubnetIds` と `DBSecurityGroup` を更新します。<pre>{<br />  "Parameters": {<br />    "SubnetIds": "subnet-xxxxxx,subnet-xxxxxx",<br />    "DBSecurityGroup": "sg-xxxxxxxxxx",<br />    "MySqlGlobalIdentifier":"rds-mysql-instance",<br />    "InitialDatabaseName": "mysqldb",<br />    "DBPortNumber": "3789",<br />    "PrimaryRegion": "us-east-1",<br />    "SecondaryRegion": "us-west-2",<br />    "KMSKeyAliasName": "rds/rds-mysql-instance-KmsKeyId"<br />  }<br />}<br /></pre><br />**Amazon Aurora**<br /> `Aurora-MySQL-parameter-us-east-1.json` ファイルで、作成したリソースの名前を付けて `SubnetIds` と `DBSecurityGroup` を更新します。<pre>{<br />  "Parameters": {<br />    "SubnetIds": "subnet1-xxxxxx,subnet2-xxxxxx",<br />    "DBSecurityGroup": "sg-xxxxxxxxxx",<br />    "GlobalClusterIdentifier":"dr-globaldb-cluster-mysql",<br />    "DBClusterName":"dbcluster-01",<br />    "SourceDBClusterName":"dbcluster-02",<br />    "DBPortNumber": "3787",<br />    "DBInstanceClass":"db.r5.large",<br />    "InitialDatabaseName": "sampledb",<br />    "PrimaryRegion": "us-east-1",<br />    "SecondaryRegion": "us-west-2",<br />    "KMSKeyAliasName": "rds/dr-globaldb-cluster-mysql-KmsKeyId"<br />  }<br />}</pre><br />**Amazon ElastiCache (Redis OSS)**<br />`ElastiCache-parameter-us-east-1.json` ファイルで、作成したリソースの名前を付けて `SubnetIds` と `DBSecurityGroup` を更新します。<pre>{<br />  "Parameters": {<br />    "CacheNodeType": "cache.m5.large",<br />    "DBSecurityGroup": "sg-xxxxxxxxxx",<br />    "SubnetIds": "subnet-xxxxxx,subnet-xxxxxx",<br />    "EngineVersion": "5.0.6",<br />    "GlobalReplicationGroupIdSuffix": "demo-redis-global-datastore",<br />    "NumReplicas": "1",<br />    "NumShards": "1",<br />    "ReplicationGroupId": "demo-redis-cluster",<br />    "DBPortNumber": "3788",<br />    "TransitEncryption": "true",<br />    "KMSKeyAliasName": "elasticache/demo-redis-global-datastore-KmsKeyId",<br />    "PrimaryRegion": "us-east-1",<br />    "SecondaryRegion": "us-west-2"<br />  }<br />}</pre> | AWS 管理者 | 
| DB インスタンスまたはクラスターをプライマリリージョンにデプロイします。 | インスタンスまたはクラスターをプライマリリージョン (`us-east-1`) にデプロイするには、データベースエンジンに基づいて次のコマンドを実行します。<br />**Amazon RDS**<pre>cd <YOUR-LOCAL-GIT-FOLDER>/App-Stack<br /><br />aws cloudformation deploy \<br />--region us-east-1 \<br />--stack-name rds-mysql-app-stack \<br />--template-file RDS-MySQL-Primary.yaml \<br />--parameter-overrides file://RDS-MySQL-parameter-us-east-1.json \<br />--capabilities CAPABILITY_AUTO_EXPAND CAPABILITY_NAMED_IAM CAPABILITY_IAM \<br />--disable-rollback</pre><br />**Amazon Aurora**<pre>cd <YOUR-LOCAL-GIT-FOLDER>/App-Stack<br /><br />aws cloudformation deploy \<br />--region us-east-1 \<br />--stack-name aurora-mysql-app-stack \<br />--template-file Aurora-MySQL-Primary.yaml \<br />--parameter-overrides file://Aurora-MySQL-parameter-us-east-1.json \<br />--capabilities CAPABILITY_AUTO_EXPAND CAPABILITY_NAMED_IAM CAPABILITY_IAM \<br />--disable-rollback</pre><br />**Amazon ElastiCache (Redis OSS)**<pre>cd <YOUR-LOCAL-GIT-FOLDER>/App-Stack<br /><br />aws cloudformation deploy \<br />--region us-east-1 --stack-name elasticache-ds-app-stack \<br />--template-file ElastiCache-Primary.yaml \<br />--parameter-overrides file://ElastiCache-parameter-us-east-1.json \<br />--capabilities CAPABILITY_AUTO_EXPAND CAPABILITY_NAMED_IAM CAPABILITY_IAM \<br />--disable-rollback<br /></pre><br /> CloudFormation リソースが正常にデプロイされたことを確認します。 | AWS 管理者 | 
| セカンダリ DB インスタンスまたはクラスターのパラメータファイルを更新します。 | `<YOUR LOCAL GIT FOLDER>/App-Stack` フォルダで、セカンダリリージョンのパラメータファイルを更新します。<br />**Amazon RDS**<br />`RDS-MySQL-parameter-us-west-2.json` ファイルで、作成したリソースの名前を付けて `SubnetIDs` と `DBSecurityGroup` を更新します。を、プライマリ DB インスタンスの CloudFormation スタックの **Outputs** セクションから`MySQLKmsKeyId`取得した の値`PrimaryRegionKMSKeyArn`で更新します。<pre>{<br />  "Parameters": {<br />    "SubnetIds": "subnet-aaaaaaaaa,subnet-bbbbbbbbb",<br />    "DBSecurityGroup": "sg-cccccccccc",<br />    "MySqlGlobalIdentifier":"rds-mysql-instance",<br />    "InitialDatabaseName": "mysqldb",<br />    "DBPortNumber": "3789",<br />    "PrimaryRegion": "us-east-1",<br />    "SecondaryRegion": "us-west-2",<br />    "KMSKeyAliasName": "rds/rds-mysql-instance-KmsKeyId",<br />    "PrimaryRegionKMSKeyArn":"arn:aws:kms:us-east-1:xxxxxxxxx:key/mrk-xxxxxxxxxxxxxxxxxxxxx"<br />  }<br />} </pre><br />**Amazon Aurora**<br />`Aurora-MySQL-parameter-us-west-2.json` ファイルで、作成したリソースの名前を付けて `SubnetIDs` と `DBSecurityGroup` を更新します。を、プライマリ DB インスタンスの CloudFormation スタックの **Outputs** セクションから`AuroraKmsKeyId`取得した の値`PrimaryRegionKMSKeyArn`で更新します。<pre>{<br />  "Parameters": {<br />    "SubnetIds": "subnet1-aaaaaaaaa,subnet2-bbbbbbbbb",<br />    "DBSecurityGroup": "sg-cccccccccc",<br />    "GlobalClusterIdentifier":"dr-globaldb-cluster-mysql",<br />    "DBClusterName":"dbcluster-01",<br />    "SourceDBClusterName":"dbcluster-02",<br />    "DBPortNumber": "3787",<br />    "DBInstanceClass":"db.r5.large",<br />    "InitialDatabaseName": "sampledb",<br />    "PrimaryRegion": "us-east-1",<br />    "SecondaryRegion": "us-west-2",<br />    "KMSKeyAliasName": "rds/dr-globaldb-cluster-mysql-KmsKeyId"<br />  }<br />}</pre><br />**Amazon ElastiCache (Redis OSS)**<br />`ElastiCache-parameter-us-west-2.json` ファイルで、作成したリソースの名前を付けて `SubnetIDs` と `DBSecurityGroup` を更新します。を、プライマリ DB インスタンスの CloudFormation スタックの **Outputs** セクションから`ElastiCacheKmsKeyId`取得した の値`PrimaryRegionKMSKeyArn`で更新します。<pre>{<br />  "Parameters": {<br />    "CacheNodeType": "cache.m5.large",<br />    "DBSecurityGroup": "sg-cccccccccc",<br />    "SubnetIds": "subnet-aaaaaaaaa,subnet-bbbbbbbbb",<br />    "EngineVersion": "5.0.6",<br />    "GlobalReplicationGroupIdSuffix": "demo-redis-global-datastore",<br />    "NumReplicas": "1",<br />    "NumShards": "1",<br />    "ReplicationGroupId": "demo-redis-cluster",<br />    "DBPortNumber": "3788",<br />    "TransitEncryption": "true",<br />    "KMSKeyAliasName": "elasticache/demo-redis-global-datastore-KmsKeyId",<br />    "PrimaryRegion": "us-east-1",<br />    "SecondaryRegion": "us-west-2"<br />  }<br />}</pre> | AWS 管理者 | 
| DB インスタンスまたはクラスターをセカンダリリージョンにデプロイします。 | データベースエンジンに基づいて、次のコマンドを実行します。<br />**Amazon RDS**<pre>cd <YOUR-LOCAL-GIT-FOLDER>/App-Stack<br /><br />aws cloudformation deploy \<br />--region us-west-2 \<br />--stack-name rds-mysql-app-stack \<br />--template-file RDS-MySQL-DR.yaml \<br />--parameter-overrides file://RDS-MySQL-parameter-us-west-2.json \<br />--capabilities CAPABILITY_AUTO_EXPAND CAPABILITY_NAMED_IAM CAPABILITY_IAM \<br />--disable-rollback</pre><br />**Amazon Aurora**<pre>cd <YOUR-LOCAL-GIT-FOLDER>/App-Stack<br /><br />aws cloudformation deploy \<br />--region us-west-2 \<br />--stack-name aurora-mysql-app-stack \<br />--template-file Aurora-MySQL-DR.yaml \<br />--parameter-overrides file://Aurora-MySQL-parameter-us-west-2.json \<br />--capabilities CAPABILITY_AUTO_EXPAND CAPABILITY_NAMED_IAM CAPABILITY_IAM \<br />--disable-rollback</pre><br />**Amazon ElastiCache (Redis OSS)**<pre>cd <YOUR-LOCAL-GIT-FOLDER>/App-Stack<br /><br />aws cloudformation deploy \<br />--region us-west-2 \<br />--stack-name elasticache-ds-app-stack \<br />--template-file ElastiCache-DR.yaml \<br />--parameter-overrides file://ElastiCache-parameter-us-west-2.json \<br />--capabilities CAPABILITY_AUTO_EXPAND CAPABILITY_NAMED_IAM CAPABILITY_IAM \<br />--disable-rollback</pre><br /> CloudFormation リソースが正常にデプロイされたことを確認します。 | AWS 管理者 | 

## 関連リソース
<a name="automate-cross-region-failover-and-failback-by-using-dr-orchestrator-framework-resources"></a>
+ [のデータベースのディザスタリカバリ戦略 AWS](https://docs.aws.amazon.com/prescriptive-guidance/latest/strategy-database-disaster-recovery/welcome.html) (AWS 規範ガイダンス戦略)
+ [でリレーショナルデータベースの DR ソリューションを自動化する AWS](https://docs.aws.amazon.com/prescriptive-guidance/latest/automate-dr-solution-relational-database/dr-orchestrator-framework-overview.html) (AWS 規範ガイダンスガイド)
+ [Amazon Aurora Global Database の使用](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-global-database.html)
+ [グローバルデータストア AWS リージョン を使用した 間のレプリケーション](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Redis-Global-Datastore.html)
+ [でリレーショナルデータベースの DR ソリューションを自動化する AWS](https://docs.aws.amazon.com/prescriptive-guidance/latest/automate-dr-solution-relational-database/introduction.html) (AWS 規範ガイダンスガイド)