1 year ago

#281140

test-img

James Young

How do I upload to rds mysql db using mysql command line directly from aws s3 bucket in aws cloudshell

I'm posting this question because I searched for an answer for several days and finally determined the correct syntax.

Using mysqldump - create .sql file backup for rds database in s3 bucket using pipe (|) syntax

mysqldump -u admin -p -h database-1.xxxx.rds.amazonaws.com --databases db1 db2 --single-transaction --order-by-primary --force | aws s3  cp - s3://bucket1/tests3.sql  

--this works 3/9/2022 dump db to s3 bucket file

restore database directly from s3 file into rds database using mysql command and s3 cli command in aws cloudshell -- looks backward but it works Avoids a lot of aws configuration in other services

aws s3  cp  s3://bucket1/tests3.sql - | mysql -h database-2.xxxx.us-east-1.rds.amazonaws.com -P 3306 -u admin -ppassword

--this works 3/11/2022 import mysqldump .sql file from s3 bucket file -- after multi day search

amazon-s3

mysqlcommand

aws-cloudshell

0 Answers

Your Answer

Accepted video resources