本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
使用 AWS CloudFormation 設定 Aurora DSQL 叢集
您可以使用相同的 CloudFormation 資源 AWS::DSQL::Cluster 來部署和管理單一區域和多區域 Aurora DSQL 叢集。
請參閲 Amazon Aurora DSQL 資源類型參考,進一步了解如何使用 AWS::DSQL::Cluster 資源建立、修改和管理叢集。
建立初始叢集組態
首先,建立 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