Import CSV file in S3 into Aurora MySql

0

I'm trying to import a CSV file from S3 into my Aurora for MySql table. Amazon Docs shows this can be done using LOAD DATA FROM S3.

However, MySQL Workbench is marking this as an error and failing. It says "S3" is not valid at this position, expecting \M\A\S\T\E\R.

I don't see a way to run the command directly on Aurora without the workbench. How can I get this to work?

I'm using MySQL Workbench 8.0.36, and a provisioned cluster running 8.0.mysql_aurora.3.04.1. As far as I can tell, I have configured permissions correctly (though the problem does not seem to be permissions related. I also have no problem running queries on my cluster from the workbench.

profile picture
已提問 3 個月前檢視次數 305 次
1 個回答
0
已接受的答案

Hello.

Have you set an IAM role for Aurora MySQL?
If you have not set it, please set it by following the steps in the document below.
https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Integrating.LoadFromS3.html#AuroraMySQL.Integrating.LoadFromS3.Authorize

Also, what command did you run?
To read the text, you need to specify the S3 URL as shown below.

LOAD DATA FROM S3 's3://mybucket/data.txt'
    INTO TABLE table1
    (column1, @var1)
    SET table_column2 = @var1/100;

To connect to Aurora MySQL without using "Workbench" you need to use MySQL commands.
You need to run the below command below.

mysql -h "Aurora MySQL Endpoint" -u root -p
profile picture
專家
已回答 3 個月前
profile picture
專家
已審閱 1 個月前
  • I did set the IAM role, and use the command with the S3 URL as in the example. Workbench appears to complain about the S3 part of the command, before even reaching the URL.

    mysql command works - thank you. It sure would have been nice to be able to run this from the workbench.

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南