

# AWS CloudFormation을 사용하여 Aurora DSQL 클러스터 구성
<a name="mr-cluster-setup"></a>

 동일한 CloudFormation 리소스 `AWS::DSQL::Cluster`를 사용하여 단일 리전 및 다중 리전 Aurora DSQL 클러스터를 배포하고 관리할 수 있습니다.

`AWS::DSQL::Cluster` 리소스를 사용하여 클러스터를 생성, 수정 및 관리하는 방법에 대한 자세한 내용은 [Amazon Aurora DSQL resource type reference](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/AWS_DSQL.html)를 참조하세요.

## 첫 번째 클러스터 구성 생성
<a name="mr-cluster-initial"></a>

먼저 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
```

## 클러스터 식별자 찾기
<a name="mr-cluster-find"></a>

클러스터의 물리적 리소스 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"
]
```

## 클러스터 구성 업데이트
<a name="mr-cluster-update"></a>

두 클러스터 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
```