> ## 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 كمستخدم مسؤول، ثم نفّذ الأوامر التالية:

1. أنشئ مستخدمًا مخصصًا لـ ClickPipes:

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

2. امنح المستخدم الذي أنشأته في الخطوة السابقة صلاحية وصول للقراءة فقط على مستوى الـ schema. يوضّح المثال التالي الأذونات الخاصة بـ schema ‏`public`. كرر هذه الأوامر لكل schema يحتوي على الجداول التي تريد تكرارها:

   ```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>
  يجب أن يكون لأي table مُدرج في الـ publication **مفتاح أساسي** معرّف، *أو* أن تكون **replica identity** الخاصة به مضبوطة على `FULL`. راجع [الأسئلة الشائعة حول Postgres](/ar/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 لجميع الجداول ضمن schema محدد:

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

يحدّد الـ publication المسمى `clickpipes` مجموعة الجداول التي ستُبث أحداث التغيير الخاصة بها إلى ClickPipes. نوصي بعدم استخدام `FOR ALL TABLES` إلا إذا كنت تنوي تكرار كل table، لأن تضمين جداول غير ضرورية يزيد من حركة WAL من Postgres إلى ClickPipes ويقلّل من الكفاءة الإجمالية للنسخ المتماثل.

<div id="iam-authentication">
  ### استخدام مصادقة IAM (اختياري)
</div>

<IAMAuthentication engine="postgres" service="aurora">
  <Note>
    يتطلب النسخ المتماثل باستخدام مصادقة IAM ضبط المعلَمة `rds.iam_auth_for_replication` على `1`.
  </Note>
</IAMAuthentication>

<div id="configure-network-access">
  ## إعداد الوصول إلى الشبكة
</div>

<div id="ip-based-access-control">
  ### التحكم في الوصول المستند إلى IP
</div>

إذا كنت تريد تقييد حركة المرور الواردة إلى عنقود Aurora، فيُرجى إضافة [عناوين IP الثابتة لـ NAT الواردة في الوثائق](/ar/integrations/clickpipes/networking/static-ips) إلى `Inbound rules` في مجموعة الأمان الخاصة بـ Aurora.

<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="حرّر قواعد Inbound لمجموعة الأمان أعلاه" 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. اتبع [دليل إعداد AWS PrivateLink لـ ClickPipes](/ar/resources/support-center/knowledge-base/cloud-services/aws-privatelink-setup-for-clickpipes) لإعداد الاتصال.

<div id="aurora-specific-considerations">
  ### اعتبارات خاصة بـ Aurora
</div>

عند إعداد ClickPipes مع Aurora PostgreSQL، ضع هذه الاعتبارات في حسبانك:

1. **نقطة نهاية الاتصال**: احرص دائمًا على الاتصال بـ نقطة نهاية الكتابة لعنقود Aurora لديك، لأن النسخ المتماثل المنطقي يتطلب صلاحية الكتابة لإنشاء replication slots، كما يجب أن يتصل بالمثيل الأساسي.

2. **التعامل مع التحويل عند الفشل**: في حال حدوث failover، سيقوم Aurora تلقائيًا بترقية مثيل قارئ ليصبح الكاتب الجديد. سيكتشف ClickPipes انقطاع الاتصال وسيحاول إعادة الاتصال بـ نقطة نهاية الكتابة، التي ستشير حينها إلى المثيل الأساسي الجديد.

3. **قاعدة البيانات العالمية**: إذا كنت تستخدم Aurora Global Database، فينبغي أن تتصل بـ نقطة نهاية الكتابة الخاص بالمنطقة الأساسية، لأن النسخ المتماثل عبر المناطق يتولى بالفعل نقل البيانات بين المناطق.

4. **اعتبارات التخزين**: تكون طبقة التخزين في Aurora مشتركة بين جميع المثيلات في العنقود، ما قد يوفّر أداءً أفضل للنسخ المتماثل المنطقي مقارنةً بـ RDS القياسي.

<div id="dealing-with-dynamic-cluster-endpoints">
  ### التعامل مع نقاط نهاية العنقود الديناميكية
</div>

في حين توفّر Aurora نقاط نهاية ثابتة تُوجِّه الاتصالات تلقائيًا إلى المثيل المناسب، فإليك بعض الأساليب الإضافية لضمان اتصال ثابت:

1. في عمليات الإعداد عالية التوافر، اضبط تطبيقك لاستخدام نقطة نهاية الكتابة في Aurora، والتي تُشير تلقائيًا إلى المثيل الأساسي الحالي.

2. إذا كنت تستخدم النسخ المتماثل عبر المناطق، ففكّر في إعداد ClickPipes منفصلة لكل Region لتقليل زمن الاستجابة وتحسين تحمّل الأعطال.

<div id="whats-next">
  ## ما الخطوة التالية؟
</div>

يمكنك الآن [إنشاء ClickPipe الخاص بك](/ar/integrations/clickpipes/postgres/index) وبدء إدخال البيانات من عنقود Aurora PostgreSQL لديك إلى ClickHouse Cloud.
احرص على تدوين تفاصيل الاتصال التي استخدمتها أثناء إعداد عنقود Aurora PostgreSQL، إذ ستحتاج إليها خلال عملية إنشاء ClickPipe.
