0

Is there a way to export data from a SQL Server query to an AWS (S3) bucket in csv file?

I created the bucket

arn:aws:s3:::s3tintegration

https://s3tintegration.s3.sa-east-1.amazonaws.com/key_prefix/

Can anybody help me?

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
  • There are [several](https://stackoverflow.com/questions/425379/how-to-export-data-as-csv-format-from-sql-server-using-sqlcmd) [stackoverflow](https://stackoverflow.com/questions/3169220/export-query-result-to-csv-file-in-sql-server-2008) [posts](https://stackoverflow.com/questions/356578/how-can-i-output-mysql-query-results-in-csv-format) that address exporting a table/query to CSV. After that you need to use something like the [AWS CLI](https://aws.amazon.com/cli/) to copy the file from a local environment to S3. – stdunbar Oct 11 '22 at 22:38

1 Answers1

1

If you are looking for Automated solution then there are several option in AWS .

  1. Schedule or trigger lambda that will connect to RDS execute query and save as csv file s3 bucket .Please remember aws lambda has to be in same vpc and subnet where your SQL server is .

  2. If you have query that takes long time you can use AWS Glue to run a task and write output to S3 in CSV format .Glue can use JDBC connection as well .

  3. You can also use DMS that will connect SQL server as source and S3 as target in CSV format .You need to lean DMS that can migrate full table or part of it but not query .

  4. If you are familiar with Big data you can very well use hive that will run your query and write to s3 in CSV format .

The quick and easiest way to start with is Lambda .

Sudarshan kumar
  • 1,503
  • 4
  • 36
  • 83