> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-trino-dialect.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Amazon Aurora Postgres를 ClickPipes 소스로 설정하는 방법

# Aurora Postgres 소스 설정 가이드

export const IAMAuthentication = ({engine, service, children}) => {
  const services = {
    aurora: {
      name: 'Aurora',
      resource: 'cluster',
      id: 'cluster-xxxxxxxxxxxxxx'
    },
    rds: {
      name: 'RDS',
      resource: 'instance',
      id: 'db-xxxxxxxxxxxxxx'
    }
  };
  const createUserStatements = {
    postgres: `CREATE USER clickpipes_iam_user;
GRANT rds_iam TO clickpipes_iam_user;`,
    mysql: `CREATE USER 'clickpipes_iam_user' IDENTIFIED WITH AWSAuthenticationPlugin AS 'RDS';`
  };
  const svc = services[String(service).toLowerCase()];
  const createUserSql = createUserStatements[String(engine).toLowerCase()];
  if (!svc) throw new Error(`Unsupported IAM authentication service: ${service}`);
  if (!createUserSql) throw new Error(`Unsupported IAM authentication engine: ${engine}`);
  return <>
      <p>
        Instead of a password, you can authenticate the ClickPipes user with an AWS IAM role. This lets ClickPipes connect to your Amazon {svc.name} {svc.resource} without storing database credentials.
      </p>

      <h4 id="enable-iam-authentication">Enable IAM authentication</h4>

      <ol>
        <li>Log in to your AWS account and go to the {svc.name} {svc.resource} you want to configure.</li>
        <li>Click <strong>Modify</strong>.</li>
        <li>Scroll to the <strong>Database authentication</strong> section.</li>
        <li>Select <strong>Password and IAM database authentication</strong>.</li>
        <li>Click <strong>Continue</strong>.</li>
        <li>Review the changes and select <strong>Apply immediately</strong>.</li>
      </ol>

      <h4 id="create-database-user">Create the ClickPipes user</h4>

      <p>Create the ClickPipes user with IAM authentication enabled, then grant it the same schema and replication privileges shown above:</p>

      <CodeBlock language="sql">{createUserSql}</CodeBlock>

      {children}

      <h4 id="obtaining-the-clickhouse-service-iam-role-arn">Obtain the ClickHouse service IAM role ARN</h4>

      <ol>
        <li>Log in to your ClickHouse Cloud account.</li>
        <li>Select the ClickHouse service you want to connect.</li>
        <li>Select the <strong>Settings</strong> tab.</li>
        <li>Scroll to the <strong>Network security information</strong> section at the bottom of the page.</li>
        <li>Copy the service's <strong>Service role ID (IAM)</strong> value, shown below.</li>
      </ol>

      <Frame>
        <img src="/images/cloud/security/secures3_arn.webp" alt="Service role ID (IAM) value in the Network security information section" />
      </Frame>

      <p>This value is your <code>{'{ClickHouse_IAM_ARN}'}</code> — the role ClickPipes uses to access your {svc.name} {svc.resource}.</p>

      <h4 id="obtaining-the-rds-resource-id">Obtain the resource ID</h4>

      <ol>
        <li>Log in to your AWS account and go to the {svc.name} {svc.resource} you want to configure.</li>
        <li>Select the <strong>Configuration</strong> tab.</li>
        <li>Note the <strong>Resource ID</strong> value — it looks like <code>{svc.id}</code>. This is your <code>{'{RDS_RESOURCE_ID}'}</code>, which you reference in the permissions policy.</li>
      </ol>

      <h4 id="manually-create-iam-role">Create the IAM role</h4>

      <ol>
        <li>Log in to your AWS account with an IAM user that has permission to create and manage IAM roles.</li>
        <li>Open the IAM console.</li>
        <li>
          Create a new IAM role with the following trust and permissions policies.

          <p>Trust policy (replace <code>{'{ClickHouse_IAM_ARN}'}</code> with the IAM role ARN of your ClickHouse instance):</p>

          <CodeBlock language="json">{`{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "{ClickHouse_IAM_ARN}"
      },
      "Action": [
        "sts:AssumeRole",
        "sts:TagSession"
      ]
    }
  ]
}`}</CodeBlock>

          <p>Permissions policy (replace <code>{'{RDS_RESOURCE_ID}'}</code> with the resource ID of your {svc.name} {svc.resource}, <code>{'{RDS_REGION}'}</code> with its region, and <code>{'{AWS_ACCOUNT}'}</code> with your AWS account ID):</p>

          <CodeBlock language="json">{`{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "rds-db:connect"
      ],
      "Resource": [
        "arn:aws:rds-db:{RDS_REGION}:{AWS_ACCOUNT}:dbuser:{RDS_RESOURCE_ID}/clickpipes_iam_user"
      ]
    }
  ]
}`}</CodeBlock>
        </li>
        <li>Once the role is created, copy its ARN. This is your <code>{'{RDS_ACCESS_IAM_ROLE_ARN}'}</code>.</li>
      </ol>

      <p>You can now use this IAM role to authenticate with your {svc.name} {svc.resource} from ClickPipes.</p>
    </>;
};

export const Image = ({img, alt, size = "lg"}) => {
  const normalizedSize = ["sm", "md", "lg"].includes(size) ? size : "lg";
  return <div className={`ch-image-${normalizedSize}`}>
      <Frame>
        <img src={img} alt={alt} />
      </Frame>
    </div>;
};

<div id="supported-postgres-versions">
  ## 지원되는 Postgres 버전
</div>

ClickPipes는 Aurora PostgreSQL 호환 에디션 12 이상을 지원합니다.

<div id="enable-logical-replication">
  ## 논리적 복제 활성화
</div>

Aurora 인스턴스에 다음 설정이 이미 구성되어 있으면 이 섹션은 건너뛰어도 됩니다.

* `rds.logical_replication = 1`

이전에 다른 데이터 복제 도구를 사용한 적이 있다면, 이 설정은 일반적으로 미리 구성되어 있습니다.

```text theme={null}
postgres=> SHOW rds.logical_replication ;
 rds.logical_replication
-------------------------
 on
(1 row)
```

아직 구성하지 않았다면 다음 단계를 따르십시오:

1. 필요한 설정이 포함된, 사용 중인 Aurora PostgreSQL 버전에 맞는 새 파라미터 그룹을 생성합니다:
   * `rds.logical_replication`을 1로 설정합니다

<Image img="https://mintcdn.com/private-7c7dfe99-trino-dialect/ZEyvJTCdFXKmprnu/images/integrations/data-ingestion/clickpipes/postgres/source/rds/parameter_group_in_blade.webp?fit=max&auto=format&n=ZEyvJTCdFXKmprnu&q=85&s=fc09fae739bd271f51157b919ec4079e" alt="Aurora에서 파라미터 그룹을 찾는 위치" size="lg" border width="1800" height="819" data-path="images/integrations/data-ingestion/clickpipes/postgres/source/rds/parameter_group_in_blade.webp" />

<Image img="https://mintcdn.com/private-7c7dfe99-trino-dialect/ZEyvJTCdFXKmprnu/images/integrations/data-ingestion/clickpipes/postgres/source/rds/change_rds_logical_replication.webp?fit=max&auto=format&n=ZEyvJTCdFXKmprnu&q=85&s=ab9ebf451918ea46d2f3696e36e5b332" alt="rds.logical_replication 변경" size="lg" border width="1800" height="795" data-path="images/integrations/data-ingestion/clickpipes/postgres/source/rds/change_rds_logical_replication.webp" />

2. 새 파라미터 그룹을 Aurora PostgreSQL 클러스터에 적용합니다

<Image img="https://mintcdn.com/private-7c7dfe99-trino-dialect/ZEyvJTCdFXKmprnu/images/integrations/data-ingestion/clickpipes/postgres/source/rds/modify_parameter_group.webp?fit=max&auto=format&n=ZEyvJTCdFXKmprnu&q=85&s=28151b7458c492a53092c800d6c70c35" alt="새 파라미터 그룹으로 Aurora PostgreSQL 수정" size="lg" border width="1800" height="1352" data-path="images/integrations/data-ingestion/clickpipes/postgres/source/rds/modify_parameter_group.webp" />

3. 변경 사항을 적용하기 위해 Aurora 클러스터를 재부팅합니다

<Image img="https://mintcdn.com/private-7c7dfe99-trino-dialect/ZEyvJTCdFXKmprnu/images/integrations/data-ingestion/clickpipes/postgres/source/rds/reboot_rds.webp?fit=max&auto=format&n=ZEyvJTCdFXKmprnu&q=85&s=9189cc820a053ed0de6f77234abcff75" alt="Aurora PostgreSQL 재부팅" size="lg" border width="1800" height="757" data-path="images/integrations/data-ingestion/clickpipes/postgres/source/rds/reboot_rds.webp" />

<div id="configure-database-user">
  ## 데이터베이스 사용자 구성
</div>

관리자 권한 사용자로 Aurora PostgreSQL writer 인스턴스에 연결한 다음, 다음 명령을 실행합니다:

1. ClickPipes 전용 사용자를 생성합니다:

   ```sql theme={null}
   CREATE USER clickpipes_user PASSWORD 'some-password';
   ```

2. 이전 단계에서 생성한 사용자에게 스키마 수준의 읽기 전용 권한을 부여합니다. 다음 예시는 `public` 스키마에 대한 권한을 보여줍니다. 복제할 테이블이 포함된 각 스키마에 대해 이 명령을 반복하십시오:

   ```sql theme={null}
   GRANT USAGE ON SCHEMA "public" TO clickpipes_user;
   GRANT SELECT ON ALL TABLES IN SCHEMA "public" TO clickpipes_user;
   ALTER DEFAULT PRIVILEGES IN SCHEMA "public" GRANT SELECT ON TABLES TO clickpipes_user;
   ```

3. 사용자에게 복제 권한을 부여합니다:

   ```sql theme={null}
   GRANT rds_replication TO clickpipes_user;
   ```

4. 복제할 테이블을 포함하는 [publication](https://www.postgresql.org/docs/current/logical-replication-publication.html)을 생성합니다. 성능 오버헤드를 피하려면 publication에는 꼭 필요한 테이블만 포함할 것을 강력히 권장합니다.

<Warning>
  publication에 포함되는 모든 테이블에는 **기본 키(primary key)** 가 정의되어 있거나, **레플리카 아이덴티티(replica identity)** 가 `FULL`로 구성되어 있어야 합니다. 범위를 어떻게 정해야 하는지에 대한 지침은 [Postgres FAQs](/ko/integrations/clickpipes/postgres/faq#how-should-i-scope-my-publications-when-setting-up-replication)를 참조하십시오.
</Warning>

* 특정 테이블에 대한 publication을 생성하려면:

  ```sql theme={null}
  CREATE PUBLICATION clickpipes FOR TABLE table_to_replicate, table_to_replicate2;
  ```

  * 특정 스키마의 모든 테이블에 대한 publication을 생성하려면:

    ```sql theme={null}
    CREATE PUBLICATION clickpipes FOR TABLES IN SCHEMA "public";
    ```

`clickpipes` publication은 변경 이벤트가 ClickPipes로 스트리밍될 테이블 집합을 정의합니다. 모든 테이블을 복제할 계획이 아니라면 `FOR ALL TABLES` 사용은 권장하지 않습니다. 불필요한 테이블이 포함되면 Postgres에서 ClickPipes로 전송되는 WAL 트래픽이 증가하고 전체 복제 효율이 저하되기 때문입니다.

<div id="iam-authentication">
  ### IAM authentication 사용(선택 사항)
</div>

<IAMAuthentication engine="postgres" service="aurora">
  <Note>
    복제에 IAM authentication을 사용하려면 `rds.iam_auth_for_replication` 매개변수를 `1`로 설정해야 합니다.
  </Note>
</IAMAuthentication>

<div id="configure-network-access">
  ## 네트워크 액세스 설정
</div>

<div id="ip-based-access-control">
  ### IP 기반 접근 제어
</div>

Aurora 클러스터로의 트래픽을 제한하려면 [문서에 안내된 정적 NAT IP 주소](/ko/integrations/clickpipes/networking/static-ips)를 Aurora 보안 그룹의 `Inbound rules`에 추가하십시오.

<Image img="https://mintcdn.com/private-7c7dfe99-trino-dialect/ZEyvJTCdFXKmprnu/images/integrations/data-ingestion/clickpipes/postgres/source/rds/security_group_in_rds_postgres.webp?fit=max&auto=format&n=ZEyvJTCdFXKmprnu&q=85&s=94cc4fa3069d9cd9a68aef2be77d731a" alt="Aurora PostgreSQL에서 보안 그룹은 어디에서 찾습니까?" size="lg" border width="1800" height="707" data-path="images/integrations/data-ingestion/clickpipes/postgres/source/rds/security_group_in_rds_postgres.webp" />

<Image img="https://mintcdn.com/private-7c7dfe99-trino-dialect/ZEyvJTCdFXKmprnu/images/integrations/data-ingestion/clickpipes/postgres/source/rds/edit_inbound_rules.webp?fit=max&auto=format&n=ZEyvJTCdFXKmprnu&q=85&s=7e5852a4a8a42c9a438075b917532273" alt="위 보안 그룹의 인바운드 규칙 편집" size="lg" border width="1800" height="935" data-path="images/integrations/data-ingestion/clickpipes/postgres/source/rds/edit_inbound_rules.webp" />

<div id="private-access-via-aws-privatelink">
  ### AWS PrivateLink를 통한 프라이빗 액세스
</div>

프라이빗 네트워크를 통해 Aurora 클러스터에 연결하려면 AWS PrivateLink를 사용할 수 있습니다. 연결을 설정하려면 [ClickPipes용 AWS PrivateLink 설정 가이드](/ko/resources/support-center/knowledge-base/cloud-services/aws-privatelink-setup-for-clickpipes)를 따르십시오.

<div id="aurora-specific-considerations">
  ### Aurora 관련 고려 사항
</div>

Aurora PostgreSQL에서 ClickPipes를 설정할 때는 다음 사항을 유의하십시오.

1. **연결 엔드포인트**: 논리적 복제에서는 replication slot을 생성하려면 쓰기 권한이 필요하며 프라이머리 인스턴스에 연결해야 하므로, 항상 Aurora 클러스터의 writer 엔드포인트에 연결하십시오.

2. **장애 조치 처리**: 장애 조치가 발생하면 Aurora는 reader를 새 writer로 자동 승격합니다. ClickPipes는 연결이 끊어진 것을 감지하고 writer 엔드포인트에 다시 연결을 시도하며, 이 엔드포인트는 이제 새 프라이머리 인스턴스를 가리키게 됩니다.

3. **Global Database**: Aurora Global Database를 사용하는 경우, 리전 간 복제가 이미 리전 간 데이터 이동을 처리하므로 프라이머리 리전의 writer 엔드포인트에 연결해야 합니다.

4. **스토리지 관련 고려 사항**: Aurora의 스토리지 계층은 클러스터의 모든 인스턴스에서 공유되므로, 표준 RDS보다 논리적 복제 성능이 더 좋을 수 있습니다.

<div id="dealing-with-dynamic-cluster-endpoints">
  ### 동적 클러스터 엔드포인트 처리하기
</div>

Aurora는 적절한 인스턴스로 자동 라우팅되는 안정적인 엔드포인트를 제공하지만, 일관된 연결을 보장하기 위한 추가적인 방법은 다음과 같습니다.

1. 고가용성 구성에서는 애플리케이션이 Aurora writer 엔드포인트를 사용하도록 구성하세요. 이 엔드포인트는 현재 프라이머리 인스턴스를 자동으로 가리킵니다.

2. 리전 간 복제를 사용하는 경우, 지연 시간을 줄이고 장애 허용을 높이기 위해 각 리전별로 별도의 ClickPipes를 설정하는 것을 고려하세요.

<div id="whats-next">
  ## 다음 단계
</div>

이제 [ClickPipe를 생성](/ko/integrations/clickpipes/postgres/index)하고 Aurora PostgreSQL 클러스터에서 ClickHouse Cloud로 데이터 수집을 시작할 수 있습니다.
ClickPipe 생성 과정에서 필요하므로 Aurora PostgreSQL 클러스터를 설정할 때 사용한 연결 정보(connection details)를 반드시 기록해 두십시오.
