Q: Import an .sql file into a rds database from local machine I'm trying to import an .sql file into a new database on my AWS RDS. the RDS can only be reached by BastionHost via SSH and is not publicly available.
Right now I copy the file to the Bastion Host like that:
scp -i key.pem ~/databases/Datenmodell_init.sql  ubuntu@ec2-88-255-112- 
102.eu-west-1.compute.amazonaws.com:~/ubuntu/Datenmodell_init.sql 

But I want to recreate the database directly without copying the file to the EC2 instance; the usual command doesnt work, obviously, since the SSH part is missing:
mysql -h mydb.co4qgzotzpzu.eu-west-1.rds.amazonaws.com  -u masteruser -p new1 < ~/databases/Datenmodell_init.sql

How can I achieve the import of the .sqlfile through the Bastion Host to the RDS via Terminal?
Merci A

A: You should be able to set up an SSH tunnel and then use that to connect to the db:
ssh -i key.pem -L 10000:mydb.co4qgzotzpzu.eu-west-1.rds.amazonaws.com:3306 ubuntu@ec2-88-255-112- 
102.eu-west-1.compute.amazonaws.com -N
mysql -h localhost -P 10000 -u masteruser -p new1 < ~/databases/Datenmodell_init.sql

There's a full explanation at eg https://medium.com/@michalisantoniou6/connect-to-an-aws-rds-using-an-ssh-tunnel-22f3bd597924
