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" ]
클러스터 구성 업데이트
두 클러스터 ARN을 모두 포함하도록 AWS CloudFormation 템플릿을 업데이트합니다.
--- 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