Managing and exporting databases efficiently is crucial for developers and database administrators working with AWS RDS Postgres. AWS RDS simplifies database management in the cloud, allowing users to focus on application development rather than database maintenance.
Exporting data from AWS RDS Postgres can be necessary for various reasons, including backups, analytics, or migration. This guide provides step-by-step instructions on how to perform an export seamlessly.
In addition, we'll explore how Sourcetable enhances this process by allowing you to export your AWS RDS Postgres database directly into a spreadsheet-like interface, providing real-time data interaction.
Before exporting data from an RDS for PostgreSQL DB instance to Amazon S3, ensure the aws_s3 extension is installed. Use the command CREATE EXTENSION aws_s3 CASCADE via psql or pgAdmin to install it. The necessary aws_commons extension installs automatically.
To export data, use the aws_s3.query_export_to_s3 function provided by the aws_s3 extension. Specify the SQL query and the Amazon S3 bucket information through the query and s3_info parameters, respectively. Note that cross-account exports and buckets encrypted with SSE-S3 are not supported.
Data exported to Amazon S3 is encrypted using an AWS managed key by default. RDS for PostgreSQL instances must be version 10.14 or later to support this feature. Ensure your RDS instance meets this requirement before proceeding.
Use the add-role-to-db-instance command with the AWS CLI to add an IAM role with export access to your PostgreSQL DB instance. Include the --feature-name s3Export option to enable exporting to S3.
DB snapshot data can be exported to Amazon S3 using the AWS Management Console, AWS CLI, or RDS API. Utilize these tools to handle snapshot exports as required for your use case.
You must install the aws_s3 extension using psql or pgAdmin with a user that has rds_superuser privileges. Use the CREATE EXTENSION command to install it.
Before using the function, ensure you have installed the required PostgreSQL extensions, determined the Amazon S3 file path where data will be exported, and confirmed that the DB instance has export access to Amazon S3.
The aws_s3 extension is compatible with all RDS for PostgreSQL versions, but it is not supported on Aurora Serverless v1.
The function requires two parameters: 'query', which is a text string containing the SQL query, and 's3_info', which is an aws_commons._s3_uri_1 composite type detailing the Amazon S3 bucket, file path, and region.
For large data exports, the aws_s3.query_export_to_s3 function will split the data into multiple files with '_partXX' appended to the file names, where 'XX' represents a sequence starting from 2.
Choosing Sourcetable provides a seamless solution for managing and querying data without the complexity of traditional database exports. It is ideal for users seeking a more accessible and interactive way to handle their data.
With Sourcetable, real-time data from AWS RDS Postgres is readily available in a familiar spreadsheet format. This approach eliminates the need for SQL expertise, making data manipulation and analysis more intuitive for spreadsheet users.
The integration of multiple data sources into a single Sourcetable spreadsheet simplifies the data consolidation process. This is particularly beneficial for users who require a unified view of their data without the hassle of manual exports and imports.
Sourcetable's spreadsheet-like interface offers a direct and real-time connection to your AWS RDS Postgres database. This feature empowers users to perform queries and manipulations instantly, enhancing productivity and decision-making.