0

Am new to AWS ,I have CSV file in amazon S3, now I want to read and import the CSV file in to aws postgres table using java.

I know we can use the below commands in CLI,

aws s3 cp s3://bucket/file.csv /mydirectory/file.csv
psql -h your_rds.amazonaws.com -U username -d dbname -c '\COPY table FROM ''file.csv'' CSV HEADER'

But I need to run it in java.

Can anyone please suggest me any solution.

kaviya .P
  • 353
  • 6
  • 18
  • see this link: https://stackoverflow.com/questions/28813025/loading-csv-data-to-a-postgresql-table – M2E67 May 29 '19 at 13:07

1 Answers1

0

If can use other options, can explore:

Load S3 Data into Amazon RDS MySQL Table

But if has to be Java, then you may AWS Lambda, as this looks to be administrative activity

  1. Read file from S3

    How to read S3 file from AWS Lambda Function written in Java?

  2. Load into RDS ( code sample ):

    Import CSV file into mysql using Java

TechFree
  • 1,531
  • 1
  • 7
  • 11