本文介绍了如何将数据文件从 s3 导入 postgresql rds的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 AWS 和 Postgresql 非常陌生.

I am very new to AWS, and Postgresql.

  1. 我创建了一个 Postgresql 数据库(在 aws 上使用 rds)
  2. 我已将多个文档上传到多个 s3 存储桶
  3. 我正在运行 EC2(Amazon Linux 64 位)

我尝试使用数据管道,但 Postgres 似乎没有可用的(模板).我不知道如何连接到我的 RDS 实例并从 postgres 导入/导出数据.

I tried to use a data pipeline, but nothing seems to be available (template) for Postgres. I can't figure out how to connect to my RDS instance and import/export data from postgres.

我假设我可以使用 EC2 从我的 S3 存储桶中抓取并导入到 Postgres,而不是没有可用的数据管道模板.如果可能的话,我不知道如何.. 如果可能,请告知..

I assumed that I could use EC2 to grab from my S3 bucket and import into Postgres in lieu of no data pipeline template being available. If it is possible I have no idea how.. Please advise if possible..

推荐答案

S3 -> RDS 直接加载现在可以用于 PostgreSQL Aurora 和 RDS PostgreSQL >= 11.1 作为 aws_s3 扩展.

S3 -> RDS direct load is now possible for PostgreSQL Aurora and RDS PostgreSQL >= 11.1 as aws_s3 extension.

参数类似于PostgreSQL COPY命令

psql=> SELECT aws_s3.table_import_from_s3(
 'table_name', '', '(format csv)',
 'BUCKET_NAME', 'path/to/object', 'us-east-2'
);

请注意,此功能不适用于旧版本.

Be warned that this feature does not work for older versions.

这篇关于如何将数据文件从 s3 导入 postgresql rds的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-24 07:22