Configura una base de datos de Amazon Aurora PostgreSQL
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
En las siguientes secciones, se explica cómo configurar una base de datos de Amazon Aurora PostgreSQL.
Crea un grupo de parámetros
Inicia el panel de Amazon RDS.
En el panel lateral de navegación, haz clic en Grupos de parámetros y, luego, en Crear grupo de parámetros. Aparecerá la página Crear grupo de parámetros.
Usa la siguiente tabla para propagar los campos de esta página y, luego, haz clic en Crear:
Campo
Descripción
Familia de grupos de parámetros
Selecciona la familia que coincide con tu base de datos.
Tipo
Selecciona Grupo de parámetros del clúster de la base de datos.
Nombre del grupo
Proporciona un nombre para el grupo de parámetros.
Descripción
Proporciona una descripción para el grupo de parámetros.
Selecciona la casilla de verificación que se encuentra a la izquierda del grupo de parámetros recién creado y, en Acciones del grupo de parámetros, haz clic en Editar.
Cambia el valor del parámetro rds.logical_replication a 1.
Haz clic en Guardar cambios.
Asigna el grupo de parámetros a la instancia de la base de datos
Inicia el panel de Amazon RDS.
En el panel lateral de navegación, haz clic en Databases y, luego, selecciona tu instancia de base de datos.
En el menú Instance Actions, selecciona Modify. Aparecerá el cuadro de diálogo Modificar instancia de base de datos.
En la sección Configuración adicional, selecciona el grupo de parámetros del clúster de base de datos que creaste.
Establece el Backup retention period en 7 días.
Haz clic en Continuar.
En el panel Programación de modificaciones, selecciona la opción Aplicar de inmediato.
Reinicia la instancia de la base de datos
Inicia el panel de Amazon RDS.
En el panel lateral de navegación, haz clic en Databases y, luego, selecciona tu instancia de base de datos.
En el menú desplegable Actions, selecciona Reboot y, luego, Confirm.
Crea una publicación y una ranura de replicación
Crea una publicación para los cambios en las tablas que deseas replicar. Te recomendamos que crees una publicación solo para las tablas que quieras replicar.
Esto permite que Datastream solo lea los datos pertinentes y reduce la carga en la base de datos y en Datastream:
CREATE PUBLICATION PUBLICATION_NAME
FOR TABLE SCHEMA1.TABLE1, SCHEMA2.TABLE2;
Reemplaza lo siguiente:
PUBLICATION_NAME: El nombre de tu publicación. Deberás proporcionar este nombre cuando crees un flujo en el asistente de creación de flujos de Datastream.
SCHEMA: Es el nombre del esquema que contiene la tabla.
TABLE: Es el nombre de la tabla que deseas replicar.
También puedes crear una publicación para todas las tablas de tu base de datos. Ten en cuenta que este enfoque aumenta la carga tanto en la base de datos de origen como en Datastream:
CREATE PUBLICATION PUBLICATION_NAME FOR ALL TABLES;
Crea una ranura de replicación ingresando el siguiente comando de PostgreSQL:
REPLICATION_SLOT_NAME: Es el nombre de tu ranura de replicación. Deberás proporcionar este nombre cuando crees un flujo en el asistente de creación de flujos de Datastream.
Crea un usuario de Datastream
Para crear un usuario de Datastream, ingresa el siguiente comando de PostgreSQL:
CREATE USER USER_NAME WITH ENCRYPTED PASSWORD 'USER_PASSWORD';
Reemplaza lo siguiente:
USER_NAME: Es el nombre del usuario de Datastream que deseas crear.
USER_PASSWORD: Es la contraseña del usuario de Datastream que deseas crear.
Otorga los siguientes privilegios al usuario que creaste:
GRANT RDS_REPLICATION TO USER_NAME;
GRANT SELECT ON ALL TABLES IN SCHEMA SCHEMA_NAME TO USER_NAME;
GRANT USAGE ON SCHEMA SCHEMA_NAME TO USER_NAME;
ALTER DEFAULT PRIVILEGES IN SCHEMA SCHEMA_NAME
GRANT SELECT ON TABLES TO USER_NAME;
Reemplaza lo siguiente:
SCHEMA_NAME: Es el nombre del esquema al que deseas otorgar privilegios.
USER_NAME: Es el usuario al que deseas otorgar los privilegios.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-04 (UTC)"],[[["\u003cp\u003eBefore setting up logical replication, ensure you have an existing Aurora cluster and are connected to the Writer endpoint of the master database server.\u003c/p\u003e\n"],["\u003cp\u003eConfigure a database cluster parameter group by creating one, setting the \u003ccode\u003erds.logical_replication\u003c/code\u003e parameter to 1, and then assigning it to the database instance.\u003c/p\u003e\n"],["\u003cp\u003eCreate a publication for the tables you want to replicate, using commands that specify either individual tables, all tables, or all tables within specified schemas.\u003c/p\u003e\n"],["\u003cp\u003eCreate a replication slot with a specific name by using the \u003ccode\u003ePG_CREATE_LOGICAL_REPLICATION_SLOT\u003c/code\u003e command.\u003c/p\u003e\n"],["\u003cp\u003eCreate a specific Datastream user with the \u003ccode\u003eCREATE USER\u003c/code\u003e command and grant it necessary privileges like \u003ccode\u003eRDS_REPLICATION\u003c/code\u003e, \u003ccode\u003eSELECT\u003c/code\u003e, and \u003ccode\u003eUSAGE\u003c/code\u003e on the relevant schemas and tables.\u003c/p\u003e\n"]]],[],null,["# Configure an Amazon Aurora PostgreSQL database\n\nThe following sections cover how to configure an Amazon Aurora PostgreSQL database.\n| Before configuring logical replication for your Amazon Aurora PostgreSQL database, make sure that you have an existing Aurora cluster and that you have connected to the Writer endpoint of your primary database server.\n\nCreate a parameter group\n------------------------\n\n1. Launch your Amazon RDS Dashboard.\n2. In the **Navigation Drawer** , click **Parameter Groups** , and then click **Create Parameter Group** . The **Create Parameter Group** page appears.\n3. Use the following table to populate the fields of this page, and then click **Create** :\n\n4. Select the checkbox to the left of your newly created parameter group, and then, under **Parameter group actions** , click **Edit**.\n5. Change the value of the `rds.logical_replication` parameter to **1**.\n6. Click **Save Changes**.\n\nAssign the parameter group to the database instance\n---------------------------------------------------\n\n1. Launch your Amazon RDS Dashboard.\n2. In the **Navigation Drawer** , click **Databases**, and then select your database instance.\n3. From the **Instance Actions** menu, select **Modify** . The **Modify DB\n Instance** dialog appears.\n4. In the **Additional configuration** section, select the database cluster parameter group that you [created](#create-a-parameter-group-aurora).\n5. Set the **Backup retention period** to **7 days**.\n6. Click **Continue**.\n7. In the **Scheduling of modifications** pane, select the **Apply\n immediately** option.\n\nReboot the database instance\n----------------------------\n\n1. Launch your Amazon RDS Dashboard.\n2. In the **Navigation Drawer** , click **Databases**, and then select your database instance.\n3. In the **Actions** drop-down menu, select **Reboot** and then **Confirm**.\n\nCreate a publication and a replication slot\n-------------------------------------------\n\n1. Create a publication for the changes in the tables you want to replicate. We\n recommend that you create a publication only for the tables that you want to replicate.\n This allows Datastream to read-only the relevant data, and lowers the\n load on the database and Datastream:\n\n ```\n CREATE PUBLICATION PUBLICATION_NAME\n FOR TABLE SCHEMA1.TABLE1, SCHEMA2.TABLE2;\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePUBLICATION_NAME\u003c/var\u003e: The name of your publication. You'll need to provide this name when you create a stream in the Datastream stream creation wizard.\n - \u003cvar translate=\"no\"\u003eSCHEMA\u003c/var\u003e: The name of the schema that contains the table.\n - \u003cvar translate=\"no\"\u003eTABLE\u003c/var\u003e: The name of the table that you want to replicate.\n\n You can also create a publication for all tables in your database. Note that\n this approach increases the load on both the source database and Datastream: \n\n ```\n CREATE PUBLICATION PUBLICATION_NAME FOR ALL TABLES;\n ```\n | For PostgreSQL 15 and later, you can create a publication for all tables in a schema. This approach lets you replicate changes for tables in the specified list of schemas, including tables that you create in the future: \n |\n | ```\n | CREATE PUBLICATION PUBLICATION_NAME\n | FOR TABLES IN SCHEMA SCHEMA1, SCHEMA2;\n | ```\n2. Create a replication slot by entering the following PostgreSQL command:\n\n ```\n SELECT PG_CREATE_LOGICAL_REPLICATION_SLOT('REPLICATION_SLOT_NAME', 'pgoutput');\n ```\n\n \u003cbr /\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eREPLICATION_SLOT_NAME\u003c/var\u003e: The name of your replication slot. You'll need to provide this name when you create a stream in the Datastream stream creation wizard.\n\nCreate a Datastream user\n------------------------\n\n1. To create a Datastream user, enter the following PostgreSQL command:\n\n ```\n CREATE USER USER_NAME WITH ENCRYPTED PASSWORD 'USER_PASSWORD';\n ```\n\n \u003cbr /\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eUSER_NAME\u003c/var\u003e: The name of the Datastream user that you want to create.\n - \u003cvar translate=\"no\"\u003eUSER_PASSWORD\u003c/var\u003e: The password for the Datastream user that you want to create.\n2. Grant the following privileges to the user you created:\n\n ```\n GRANT RDS_REPLICATION TO USER_NAME;\n GRANT SELECT ON ALL TABLES IN SCHEMA SCHEMA_NAME TO USER_NAME;\n GRANT USAGE ON SCHEMA SCHEMA_NAME TO USER_NAME;\n ALTER DEFAULT PRIVILEGES IN SCHEMA SCHEMA_NAME\n GRANT SELECT ON TABLES TO USER_NAME;\n ```\n\n \u003cbr /\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eSCHEMA_NAME\u003c/var\u003e: The name of the schema to which you want to grant the privileges.\n - \u003cvar translate=\"no\"\u003eUSER_NAME\u003c/var\u003e: The user to whom you want to grant the privileges.\n\nWhat's next\n-----------\n\n- Learn more about how Datastream works with [PostgreSQL sources](/datastream/docs/sources-postgresql)."]]