Reputation: 373
My Stored Procedure to write on S3 bucket
DELIMITER //
CREATE PROCEDURE export_product
()
BEGIN
SET @SQLString = CONCAT('SELECT * FROM product INTO OUTFILE "https:\\s3-ap-southeast-1.amazonaws.com\bucket\download\product.csv" FIELDS TERMINATED BY ","
LINES TERMINATED BY "\n" ');
PREPARE test2 FROM @SQLString;
EXECUTE test2;
END //
DELIMITER ;
Upvotes: 2
Views: 2727
Reputation: 10874
You cannot write from MySQL RDS directly to S3.. Few Options:
you need to move to MySQL Aurora RDS( Aurora being AWS service can talk to other AWS Services ).
write a shell script which will run this SQL Query against your MySQL RDS. Redirect output to a flat csv file.. and then copy this csv to S3 using AWS CLI.
You can also evaluate AWS Data pipeline
Upvotes: 4