AWS CloudFormation を使用したマルチリージョンクラスターの設定 - Amazon Aurora DSQL

AWS CloudFormation を使用したマルチリージョンクラスターの設定

同じ AWS CloudFormation リソース AWS::DSQL::Cluster を使用して、単一リージョンおよびマルチリージョンの Aurora DSQL クラスターをデプロイおよび管理できます。

AWS::DSQL::Cluster リソースを使用して、クラスターを作成、変更、管理する方法については、「Amazon Aurora DSQL resource type reference」を参照してください。

初期クラスター設定の作成

まず、マルチリージョンクラスターを定義する AWS CloudFormation テンプレートを作成します。

--- Resources: MRCluster: Type: AWS::DSQL::Cluster Properties: DeletionProtectionEnabled: true MultiRegionProperties: WitnessRegion: us-west-2

次の AWS CLI コマンドを使用して、両方のリージョンにスタックを作成します。

aws cloudformation create-stack --region us-east-2 \ --stack-name MRCluster \ --template-body file://mr-cluster.yaml
aws cloudformation create-stack --region us-east-1 \ --stack-name MRCluster \ --template-body file://mr-cluster.yaml

クラスター識別子の検索

クラスターの物理リソース ID を取得します。

aws cloudformation describe-stack-resources -region us-east-2 \ --stack-name MRCluster \ --query 'StackResources[].PhysicalResourceId' [ "auabudrks5jwh4mjt6o5xxhr4y" ]
aws cloudformation describe-stack-resources -region us-east-1 \ --stack-name MRCluster \ --query 'StackResources[].PhysicalResourceId' [ "imabudrfon4p2z3nv2jo4rlajm" ]

クラスター設定の更新

AWS CloudFormation テンプレートを更新して、以下の両方のクラスター ARN を含めます。

--- Resources: MRCluster: Type: AWS::DSQL::Cluster Properties: DeletionProtectionEnabled: true MultiRegionProperties: WitnessRegion: us-west-2 Clusters: - arn:aws:dsql:us-east-2:123456789012:cluster/auabudrks5jwh4mjt6o5xxhr4y - arn:aws:dsql:us-east-1:123456789012:cluster/imabudrfon4p2z3nv2jo4rlajm

更新した設定を両方のリージョンに適用します。

aws cloudformation update-stack --region us-east-2 \ --stack-name MRCluster \ --template-body file://mr-cluster.yaml
aws cloudformation update-stack --region us-east-1 \ --stack-name MRCluster \ --template-body file://mr-cluster.yaml