89

I recently downgraded my EC2 instance. I can no longer connect to RDS. I think it might be that the internal IP is different and now the logins are attached to that specific IP. I haven't been able to figure it out. I would like to be able to get a backup from the snapshot. Is there a way to download it through AWS?

8 Answers 8

74

You can't download an RDS snapshot. You can however connect to it and export your databases. Downgrading your instance should not affect connectivity unless you had set up your security groups incorrectly (Opening ports to an IP instead of another security group).

10
  • I have verified that the EC2 instance can connect by telnet to port 3306 on the RDS endpoint. However my logins do not work. My security group did not even have mysql specified (I think that is for inbound into the EC2 instance anyway). The db security group has the EC2 security group specified which my EC2 instance also has. I believe that is how it is supposed to be set up. That is what worked initially. I just tried an older password than the one that was in my files and it worked. It is good to know for sure that one cannot download an RDS snapshot though. Thank you!
    – William
    Feb 17, 2013 at 3:11
  • 7
    How do you connect to a snapshot? Can it be done without restoring that snapshot to the db?
    – ScotterC
    Aug 19, 2013 at 20:27
  • 13
    @ScotterC, you need to create a new instance with the snapshot.
    – datasage
    Aug 19, 2013 at 20:34
  • 6
    @datasage an example of this would have been good. Pretty lazy answer
    – hmedia1
    Oct 3, 2018 at 13:08
  • 7
    This seems way more complicated than it should be. Feb 2, 2020 at 0:40
47

The accepted answer is not up-to-date anymore. Instead of using command line tools, you can use the AWS console.

Navigate to RDS -> Snapshots -> Manual/System ->

Select Snapshot -> Actions -> Export to S3

Going through S3 is common in most production environments, as you won't have direct access to the DB instance.

AWS RDS Console with Export to S3

7
  • 2
    as a clarification : this is only true in a selected list of regions, not available everywhere: aws.amazon.com/about-aws/whats-new/2020/01/… Mar 4, 2020 at 9:33
  • 2
    I'm getting "Missing required key 'KmsKeyId' in params" every time I attempt to export a snapshot. Are we forced to use encryption?
    – BenMorel
    Jan 21, 2021 at 14:02
  • 1
    for some reason my option to Export to S3 is greyed out :/
    – Casey L
    Feb 10, 2021 at 20:42
  • 1
    You can export to to S3, from which you could download, but then it will be encrypted using KMS key which you can't download which would make your package useless on any environment remote to AWS. Am I right? Mar 18, 2021 at 5:51
  • 7
    This exports in Parquet format, which may not be what you want.
    – Mr. S
    Aug 12, 2021 at 19:55
13

In addition to datasage answer.

As an option for production instance you can create a readonly replica in RDS and make dumps from this replica. You could avoid freezing of production DB this way.

We use this scheme for PostgreSQL + pg_dump. Hope it will be helpful to somebody else too.

5

I use:

pg_dump -v -h RDS_URL -Fc -o -U username dbname > your_dump.sql

2
  • 2
    Thank you for your answer - although code/config snippets might provide some limited short-term help, a proper explanation would greatly improve its long-term value by showing why this is a good solution to the problem, and would make it more useful to future readers with other, similar questions. Please edit your answer to add some explanation, including the assumptions you've made.
    – kenny_k
    Oct 7, 2019 at 13:40
  • Short versions of flags are for writing. Long versions are for reading
    – Ben Longo
    Aug 10 at 22:11
3

I also needed to do this so I created a dump of the db (MySQL) by logging into my app server which has permissions to access the db. I then downloaded the dump to my local machine using scp. I used:

mysqldump -uroot -p -h<HOST> --single-transaction <DBNAME> > output.sql
3
  • This is unhelpful for two reasons: first of all it doesn't answer the question, and second of all this requires connecting with the RDS instance, and OP is asking this question precisely because they can't.
    – toon81
    Mar 26, 2019 at 11:48
  • @toon81 actually he covers connection issue. If you unable to connect from outside, you would be able to connect from EC2, if that's VPC issue. Jun 22, 2019 at 18:28
  • @BogdanMart Since downgrading their EC2 instance, OP is unable to connect, suggesting that they were trying to connect from the EC2 instance all along. Anyway, it still doesn't matter because OP isn't asking about how to connect. I think they should be, but the fact remains this question is about something else.
    – toon81
    Jun 23, 2019 at 21:55
1

Another option is to share your snapshot if you don't need to download it and just want to share it with a different AWS account ID.

1
  • You will need to share master key as well, or it won't be possible to decrypt the snapshot. Aug 28 at 9:20
1

It sounds like your RDS is within a VPC inside a private subnet with security group and ACL. The only way to solve your issue is to take a snapshot and cerate a new DB instance out of it within the default VPC where all connections are allowed. After that you take backup classic backup using a db client or CLI.

0

The "Export to S3" option worked for me. I was able to restore only the table I wanted and view it locally using the "Tad" app.

Your Answer

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

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