Skip to content

RDS

Created: 2016-02-17 11:23:38 -0800 Modified: 2019-09-25 10:37:42 -0700

  • You can stop your instances to save money (reference).
  • Aurora has an auto_pause feature that lets it sleep when there are no active connections to the database. This is not intended for user-facing production usage as unpausing the database takes about 30 seconds (as of 11/27/2018).
  • Aurora snapshots cannot be loaded into the same cluster that you already have; you have to make a new one. This can take upwards of ~30 minutes.
  • Aurora measures memory and CPU in Aurora Capacity Units (ACUs). It seems like 1 ACU = 2 GB RAM, but I don’t know about CPU usage or number of connections allowed.
  • Aurora, when used in serverless mode, cannot be made publicly accessible (reference). You must connect through an EC2 instance in the same VPC.
  • Go to AWS console, launch DB instance, follow the straightforward instructions.
    • This process allows you to optionally specify a database name. If you don’t specify one, then RDS will not actually create a database for you. There are no options to open the database to more users; you have to do that manually afterward.
    • If you’re trying to stick to the free tier, make sure to look at the left side of the screen for a warning about no longer being eligible for it: “The following selections disqualify the instance from being eligible for the free tier: <content>“
    • Note: if you deleted your default VPC, then you’ll need to manually choose the VPC when you get to that point.
    • When you get to the point where you can configure Network and Security, you can make it publicly accessible and then choose “Create new Security Group” so that your current IP address (from which you’re accessing the console) will be granted permissions.
      • This seems to be the action by default.
  • Connecting to MySQL (reference):
    • In short, copy text from the “Endpoint” section (but without the automatically-highlighted port at the end) from your RDS dashboard and connect with this command:
      • mysql -h <endpoint_without_port> -P 3306 -u root -p
  • When creating a user in the database, you typically run a command like this:
    • CREATE USER ‘TomAto’@‘localhost’ IDENTIFIED BY ‘password’;
    • The host has to be the host where you’re accessing the database. Because this is AWS, you will need to specify your public IP address as the host.

Migrating your database from RDS to Aurora

Section titled Migrating your database from RDS to Aurora

Update: I never finished writing these steps. I ended up giving up completely.

You can’t download snapshots that RDS takes for you, so here’s what I did to export the database:

  1. Log into the AWS Console
  2. Make an EC2 instance in the same VPC as the database. Make sure you put it in a subnet with access to an Internet gateway.
  3. Modify security groups so that I have access to the instance (didn’t need to do anything for this) and it has access to the database
  4. ssh -i $keyLocation ec2-user@ip_address
    1. If this doesn’t work, read this.
  5. sudo yum install mysql
  6. Modify the following commands as necessary:

set keyLocation=D:/Code/JavaScript/learning/aws/Firstkeypair.pem

set localDumpDestination=C:Usersagd13 _000Desktopbotland_backup

set localDbName=botland_prod_copy

set dumpFileName=botland_prod_dump.sql

set startingDir=%cd%

set dbHost=botland.cf0zzchzuj27.us-west-2.rds.amazonaws.com

set ec2user=ec2-user

ssh -i %keyLocation% %ec2user%@%instanceIp% “/usr/bin/mysqldump -u root -h %dbHost% —password=%dbPassword% botland > %dumpFileName%“

scp -i %keyLocation% %ec2user%@%instanceIp%:/home/%ec2user%/botland_prod_dump.sql ./

  1. Remember: the existence of the dump file on your hard drive likely has incredibly sensitive information. It’s on both the EC2 instance (which you can now terminate) and your local hard drive. This would be a violation of GDPR if you kept it for any longer than necessary without scrubbing PII.
  2. …never mind, it sounds like the options for doing this are too challenging.