0

Our company has an RDS instance of a Postgres database in AWS. I don't have much experience with AWS.

I'd like to run a very lengthy query against the database (VACUUM FULL) that may take many hours or even days. I can connect to the database from my laptop by creating a tunnel to AWS using a tool called "passport".

The problem is that if I initiate a query from my laptop and then my internet connection drops, or laptop reboots, or something else happens in the network between my laptop and the amazon's computer, the query will be interrupted and I will lose any output the query may generate.

In the good old days when I had a server running an operating system with a database on it I could connect to that operating system (remote desktop or ssh or whatever) and then run a program on that server (pgAdmin, psql, etc) that would connect to the database locally, to the "localhost". Then I could leave it running, disconnect from the server and come back next day, connect back to it and see results in that instance of pgAdmin still running on that server. In that case there was no network between the application that was running the query and the database.

Is it possible to have something like that with RDS? How?

1 Answer 1

4

One way I have done these "long-running connection required" tasks on AWS is to start an EC2 instance, install the proper tools, run tmux and let it go. Detach, turn my computer off. The ec2 instance is still running and tmux is running my program. This was not with RDS but the concept is the same. As long as the ec2 connection to RDS does not get interrupted, the program runs. Your shell into the ec2 instance does not need to stay connected if the program is being run properly by tmux.

Then can build shell scripts to install the tools and other scripts to start the ec2 instance so starting the environment is push-button.

1
  • I see. Thank you for the suggestion. There is still a network between EC2 instance and RDS instance, but if there is no other way I'll have to use this method I guess. Commented Jul 11 at 0:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.