

 Amazon Redshift는 패치 198부터 새 Python UDF 생성을 더 이상 지원하지 않습니다. 기존 Python UDF는 2026년 6월 30일까지 계속 작동합니다. 자세한 내용은 [블로그 게시물](https://aws.amazon.com/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/)을 참조하세요.

# IAM 역할을 클러스터와 연결
<a name="copy-unload-iam-role-associating-with-clusters"></a>

Amazon Redshift가 다른 AWS 서비스에 액세스하도록 권한을 부여하는 IAM 역할을 만든 후에는 해당 역할을 Amazon Redshift 클러스터와 연결해야 합니다. 역할을 사용하여 데이터를 로드하거나 언로드하려면 먼저 이 작업을 수행해야 합니다.

## IAM 역할을 클러스터와 연결하는 데 필요한 권한
<a name="copy-unload-iam-role-associating-with-clusters-perms"></a>

IAM 역할을 클러스터와 연결하려면 사용자에게 해당 IAM 역할에 대한 `iam:PassRole` 권한이 필요합니다. 이 권한을 통해 관리자는 사용자가 Amazon Redshift 클러스터와 연결할 수있는 IAM 역할을 제한 할 수 있습니다. 가장 좋은 방법은 권한 정책을 IAM 역할에 연결한 다음 필요에 따라 사용자 및 그룹에 할당하는 것입니다. 자세한 내용은 [Amazon Redshift의 Identity and Access Management](https://docs.aws.amazon.com/redshift/latest/mgmt/redshift-iam-authentication-access-control.html)를 참조하세요.

다음은 이러한 작업이 가능하도록 사용자에게 추가할 수 있는 IAM 정책 예입니다.
+ 해당 사용자의 계정이 소유한 모든 Amazon Redshift 클러스터에 대한 세부 정보를 가져옵니다.
+ 3가지 IAM 역할 중 하나를 2개의 Amazon Redshift 클러스터 중 하나와 연결합니다.

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "redshift:DescribeClusters",
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Action": [
                 "redshift:ModifyClusterIamRoles",
                 "redshift:CreateCluster"
            ],
            "Resource": [
                 "arn:aws:redshift:us-east-1:123456789012:cluster:my-redshift-cluster",
                 "arn:aws:redshift:us-east-1:123456789012:cluster:my-second-redshift-cluster"
            ]
        },
        {
            "Effect": "Allow",
            "Action": "iam:PassRole",
            "Resource": [
                "arn:aws:iam::123456789012:role/MyRedshiftRole",
                "arn:aws:iam::123456789012:role/SecondRedshiftRole",
                "arn:aws:iam::123456789012:role/ThirdRedshiftRole"
             ]
        }
    ]
}
```

------

사용자에게 적절한 권한이 부여되면 해당 사용자는 Amazon Redshift 클러스터와 IAM 역할을 연결할 수 있습니다. 그런 다음 IAM 역할은 COPY 또는 UNLOAD 명령이나 다른 Amazon Redshift 명령과 함께 사용할 수 있습니다.

IAM 정책에 대한 자세한 내용은 *IAM User Guide*의 [Overview of IAM policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html)를 참조하세요.

## 클러스터와 IAM 역할 연결 관리
<a name="managing-iam-role-association-with-cluster"></a>

클러스터를 생성할 때는 IAM 역할을 Amazon Redshift 클러스터와 연결할 수 있습니다. 또는 기존 클러스터를 수정하고 하나 이상의 IAM 역할 연결을 추가하거나 제거할 수 있습니다.

다음에 유의하세요.
+ 연결할 수 있는 최대 IAM 역할 수는 할당량에 따라 달라집니다.
+ IAM 역할을 여러 Amazon Redshift 클러스터와 연결할 수 있습니다.
+ IAM 역할과 클러스터가 동일한 AWS 계정에 의해 소유된 경우에만 IAM 역할을 Amazon Redshift 클러스터와 연결할 수 있습니다.

IAM 역할과 클러스터의 연결은 다음 단계에 따라 콘솔에서 관리할 수 있습니다.

**IAM 역할 연결을 관리하려면**

1. AWS Management Console에 로그인한 후 [https://console.aws.amazon.com/redshiftv2/](https://console.aws.amazon.com/redshiftv2/)에서 Amazon Redshift 콘솔을 엽니다.

1. 탐색 메뉴에서 **클러스터(Clusters)**를 선택한 후 업그레이드할 클러스터를 선택합니다.

1. **작업(Actions)**에서 **IAM 역할 관리(Manage IAM roles)**를 선택하여 클러스터와 연결된 현재 목록 IAM 역할을 표시합니다.

1. **IAM 역할 관리(Manage IAM roles)** 페이지에서 추가하려는 사용 가능한 IAM 역할을 선택한 다음 **Add IAM role(IAM 역할 추가)**을 선택합니다.

1. **완료(Done)**를 선택하여 변경 사항을 저장합니다.

다음과 같은 접근 방법을 사용하여 AWS CLI에서 클러스터에 대한 IAM 역할을 관리할 수 있습니다.

클러스터를 생성할 때 IAM 역할을 클러스터와 연결하려면 `--iam-role-arns` 명령의 `create-cluster` 파라미터에서 IAM 역할의 Amazon 리소스 이름(ARN)을 지정해야 합니다. `create-cluster` 명령을 호출할 때 추가할 수 있는 최대 IAM 역할 수에는 할당량이 적용됩니다.

Amazon Redshift 클러스터와 IAM 역할의 연결 및 연결 해제는 비동기 프로세스입니다. IAM 역할과 클러스터의 모든 연결 상태는 `describe-clusters` 명령을 호출하여 확인할 수 있습니다.

다음은 IAM 역할 2개를 새롭게 생성한 클러스터인 `my-redshift-cluster`와 연결하는 예입니다.

```
aws redshift create-cluster \
    --cluster-identifier "my-redshift-cluster" \
    --node-type "ra3.4xlarge" \
    --number-of-nodes 16 \
    --iam-role-arns "arn:aws:iam::123456789012:role/RedshiftCopyUnload" \
                    "arn:aws:iam::123456789012:role/SecondRedshiftRole"
```

IAM 역할을 기존 Amazon Redshift 클러스터와 연결하려면 `modify-cluster-iam-roles` 명령의 `--add-iam-roles` 파라미터에 대한 IAM 역할의 Amazon 리소스 이름(ARN)을 지정합니다. `modify-cluster-iam-roles` 명령을 호출할 때 추가할 수 있는 최대 IAM 역할 수에는 할당량이 적용됩니다.

다음은 IAM 역할을 기존 클러스터인 `my-redshift-cluster`와 연결하는 예입니다.

```
aws redshift modify-cluster-iam-roles \
    --cluster-identifier "my-redshift-cluster" \
    --add-iam-roles "arn:aws:iam::123456789012:role/RedshiftCopyUnload"
```

클러스터에서 IAM 역할을 연결 해제하려면 `modify-cluster-iam-roles` 명령의 `--remove-iam-roles` 파라미터에서 IAM 역할의 ARN을 지정해야 합니다.`modify-cluster-iam-roles` `modify-cluster-iam-roles` 명령을 호출할 때 삭제할 수 있는 최대 IAM 역할 수에는 할당량이 적용됩니다.

다음은 `my-redshift-cluster`라는 클러스터에서 `123456789012` AWS 계정에 속한 IAM 역할 연결을 제거하는 예입니다.

```
aws redshift modify-cluster-iam-roles \
    --cluster-identifier "my-redshift-cluster" \
    --remove-iam-roles "arn:aws:iam::123456789012:role/RedshiftCopyUnload"
```

### AWS CLI를 사용하여 클러스터에 대한 IAM 역할 연결 나열
<a name="w2aac37c30c30c35c31b7b9c29"></a>

Amazon Redshift 클러스터와 관련된 모든 IAM 역할과 IAM 역할 연결의 상태를 나열하려면 `describe-clusters` 명령을 호출합니다. 그러면 다음 예 출력과 같이 클러스터와 연결되어 있는 IAM 역할 각각의 ARN이 `IamRoles` 목록으로 반환됩니다.

클러스터와 연결된 역할은 상태가 `in-sync`로 표시됩니다. 클러스터와 연결이 진행 중인 역할은 상태가 `adding`으로 표시됩니다. 클러스터와 연결 해제 중인 역할은 상태가 `removing`으로 표시됩니다.

```
{
    "Clusters": [
        {
            "ClusterIdentifier": "my-redshift-cluster",
            "NodeType": "ra3.4xlarge",
            "NumberOfNodes": 16,
            "IamRoles": [
                {
                    "IamRoleArn": "arn:aws:iam::123456789012:role/MyRedshiftRole",
                    "IamRoleApplyStatus": "in-sync"
                },
                {
                    "IamRoleArn": "arn:aws:iam::123456789012:role/SecondRedshiftRole",
                    "IamRoleApplyStatus": "in-sync"
                }
            ],
            ...
        },
        {
            "ClusterIdentifier": "my-second-redshift-cluster",
            "NodeType": "ra3.4xlarge",
            "NumberOfNodes": 10,
            "IamRoles": [
                {
                    "IamRoleArn": "arn:aws:iam::123456789012:role/MyRedshiftRole",
                    "IamRoleApplyStatus": "in-sync"
                },
                {
                    "IamRoleArn": "arn:aws:iam::123456789012:role/SecondRedshiftRole",
                    "IamRoleApplyStatus": "in-sync"
                },
                {
                    "IamRoleArn": "arn:aws:iam::123456789012:role/ThirdRedshiftRole",
                    "IamRoleApplyStatus": "in-sync"
                }
            ],
            ...
        }
    ]
}
```

AWS CLI 사용에 대한 자세한 내용은 *[AWS CLI User Guide](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html)*를 참조하세요.