Marius
Marius

Reputation: 974

How can I make my local mysql settings match Amazon RDS?

I have a setup where I develop locally using a local mysql instance and then I push my code to AWS, which uses an RDS MySQL instance.

I want to make my local database match RDS settings as closely as possible. I run into configuration problems, where an obvious issue does not exhibit itself in local development, but my tests fail on RDS. For example, one recent issue was that the RDS default charset for tables is latin1 whereas the default settings for brew-installed mysql is UTF-8.

I can solve these problems as they occur, but it would be really useful to do a bulk-setup that configures my local MySQL to match RDS as much as possible.

Is this doable?

Upvotes: 4

Views: 3354

Answers (3)

Brett
Brett

Reputation: 2833

The aws cli can be used to retrieve your RDS configuration. The command I used to pull it down is below. Replace YOUR_PARAMETER_GROUP_NAME with your RDS parameter group name and the --source can be system, user or engine-default (or remove the --source argument and it will retrieve them all). The below command uses jq as well.

aws rds describe-db-parameters --db-parameter-group-name YOUR_PARAMETER_GROUP_NAME --source system | jq -r '.Parameters[] | (.ParameterName + "=" + .ParameterValue)'

Upvotes: 3

ysalmi
ysalmi

Reputation: 539

Here's a short powershell command (based on the suggested answer) to retrieve all the non-default parameters for a specified parameter group (replace "default.mysql-57" with the specific parameter group name you are using):

Get-RDSDBParameter -DBParameterGroupName default.mysql5.7 | 
  select ParameterName, ParameterValue |
  where {$_.ParameterValue -ne $null}

Upvotes: 0

Mark B
Mark B

Reputation: 200910

Just go into the parameter group you are using in RDS and copy all those settings to your local MySQL server.

Upvotes: 3

Related Questions