How do I increase MySQL database size? - mysql

I have an existing production database which only has 5GB of space, which is not enough. I would like to increase this size, however AWS does not let you do this with SQL databases. How should I do this?
I tried creating a snapshot and making a new database with it however I could not set the database size for some reason.
Is there a solution for this?

RDS instances have a set of settings exposed that you can modify. For RDS instances running MySQL, allocated storage size is one of these settings.
To modify a DB instance running the MySQL engine from the AWS web console (from linked documentation):
Sign in to the AWS Management Console and open the Amazon RDS console at https://console.aws.amazon.com/rds/.
In the navigation pane, click Instances.
Select the check box for the DB instance that you want to change, click Instance Actions and then click Modify.
In the Modify DB Instance dialog box, modify [the setting labeled "Allocated Storage"].
At the bottom of the Modify DB instance dialog, there is a checkbox labeled "apply immediately." If this checkbox is selected, the change will begin immediately and your RDS instance will enter the modifying state. No further modifications can be made to the instance settings during this time. Your database should not experience downtime while these changes are being made, but performance will be degraded. If you do not select this checkbox, the change will be applied during your RDS instance's next maintenance window.
Note that altering other settings and applying immediately can result in downtime, depending on what you want to change. Check this documentation for a full list.
You can alternatively perform this operation programmatically, via:
API: ModifyDBInstance
CLI: aws rds modify-db-instance

Upgrading a MySQL DB instance can be tricky but easy to achieve through the following steps.
1. Ensure that running an updated version of MySQL Engine(not deprecated).
Trying to upgrade a deprecated MySQL Version via the AWS Console(UI) results in an error message."
"Cannot find version 5.... for mysql (Service: AmazonRDS; Status Code:
400; Error Code: InvalidParameterCombination; Request ID:........"
Even Snapshot Restore is most likely to run for several mins/hours without any success.
2.Use AWS CLI
Use 'modify-db-instance' command to scale the storage size[1] and applied the version upgrade on your DB instance.
Here's the example command:
aws rds modify-db-instance \
--db-instance-identifier <RDS_identifier> \
--allocated-storage <storage_size> \
--apply-immediately
You may also refer to this guide on to install AWS CLI toll: Installing the AWS Command Line Interface - [https://docs.aws.amazon.com/cli/latest/userguide/installing.html][1]
3.After the successful upgrade, optionally modify/upgrade your MySQL version to a non depreciated Version via the AWS Console(UI).

Related

Unable to decouple postgres db from ElasticBeanstalk Instance

We have an ElasticBeanstalk instance, with an internal postgres database.
As you know, there's the possibility to have internal (coupled) or external (decoupled) databases on ElasticBeanstalk
Since last year, there is the possibility to decouple internal databases from an ElasticBeanstalk instance, since these are coupled or 'tied' to the instance itself.
We want to have an external database instead of the internal one, because the new external database is encrypted, anyway, that's the reason why we want to decouple the existing one.
But if I go EB->Environments->Environment->Configuration->Database section
Then click 'Decouple Database', it shows me a MySQL related error (???), the db is postgres, no doubts about it, there's no hint to MySQL at any point in the lifetime of this EB instance.
And if I try from the eb cli the error is different but always MySQL related:
Any ideas about this?

MySQL read replica on Mac with Homebrew

I've recently started using AWS Aurora to take advantage of the improvements over standard MySQL. I have a REST API running that connects either to the main cluster endpoint, or the read endpoint if the request will only perform SELECTs. Obviously I want to test this locally so that I don't mark any routes as read only if they're not.
I installed mysql with Homebrew and have it running as a service. What I need to do now is have another mysql instance running on a different port, and then set up read replication between my original instance and the new one.
Does anyone have any idea how I go about this?

Restoring SQL backup on Amazon RDS database

How is it so difficult to find out how to do this? All I need is to run some simple SQL to restore our existing database on a new RDS database.
Tried connecting with SQL Server Management Studio, it won't connect.
Tried using the Database Migration Tool, it doesn't make any sense.
All the documentation for this seems to assume I'm trying to move some monumental database with zero downtime. Literally all I need to do is run an SQL file on a RDS database. Does anybody on earth understand how this works??
You can use Native backup and Restore. Amazon RDS supports native backup and restore for Microsoft SQL Server databases using full backup files.
Though it wouldn't work on db.t1.micro DB instance class.
You can add Native Backup and restore option by doing following according to the AWS docs.
Create a new option group, or copy or modify an existing option group.
Add the option to the option group.
Associate the option group with the DB instance.
After you add the Native Backup and Restore option, you don't need to restart your DB instance. As soon as the option group is active, you can begin backing up and restoring immediately.
If you cannot connect to the you need to check your RDS security group. Make sure port 3389 is open to your IP,
There is good documentation for connecting to RDS from the Management Studio here:
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ConnectToMicrosoftSQLServerInstance.html
It states the following:
After Amazon RDS provisions your DB instance, you can use any standard
SQL client application to connect to the DB instance. In this topic
you connect to your DB instance by using either Microsoft SQL Server
Management Studio (SSMS) or SQL Workbench/J.
Also double check that the RDS instance is on a public subnet and that you have allowed public access to it. See those settings in Configure Advanced Settings:

MySQL is not working after resizing EC2 instance

I have configured separate MySQL Production server as EC2- m2.xlarge. This is ubuntu server.MySQL is working perfectly from 3 years on this instance.
But now I thought of downgrading a server because of less usage. When I stepped ahead to downgrade the server as m1.medium or m1.small using steps given by AWS , I was able to resize it and started it with reassigning my original elastic IP, I found MySQL is now connecting from anywhere.
I troubleshooted to connect MYSQL after resize as follows.
1. connected with ssh login on same instance and used command-line to connect.
2. Tried from outside(workbench) with same configuration..
3. Checked security groups assigned to instance. those are also in place..
4. But when I again resize instance with original (m2.xlarge), It works .
Still no success. any thing I missed after resizing process?

CloudFormation : Template RDS Mysql to Create DB, Tables, User, or Load Schema

Using CloudFormation, I'm trying to figure out a few use cases.
The first case is having an existing AWS RDS MySQL server, how to create a database, tables, and a user account though a CloudFormation template.
After looking at the Cloudformation docs, I thought there could be a
AWS::RDS::DBInstance property that would allow me to do this action; however, though I couldn't find how to specify a database host source (or I may have misread it) that would allow.
aws-properties-rds-database-instance
then, looking at the Cloudformation RDS templates from AWS, I saw an fn::join command that stood out. Would my first case be done with fn::join?
"UserData": { "Fn::Base64": { "Fn::Join": ["", [....
Next, in the second case, I'm also having trouble finding how using an existing RDS MySQL server, load a scheme from a MySQL mysqldump.
I've looked at the docs in the link above for answers but not quite sure. I noticed AWS templates mostly allow you to create resources.
Lastly, to solve the above two cases, I've also been reading that it could or should(?) be done using a two tool approach by way of using an AWS CloudFormation template and calls to Chef.
Thoughts?
Short answer is : you can't, right now, automatically run SQL queries at instance creation (in the future, who knows...).
I would use the following way to resolve this classic problem:
Use an EC2 to run the MySQL code you need (not sure if you need to put a "DependsOn" clause in the EC2, since you will have to refer to the RDS endpoint with a GetAtt, which will probably put an implicit DependsOn clause). You put this in the user data or any script you want, as long as you pass the RDS endpoint somehow. Of course, you will need the MySQL client package installed on your EC2.
As you wrote, CloudFormation allows you to create AWS resources, but populationg those resources is up to you. Once again, a MySQL client will do the trick (since a MySQL dump is no more than SQL code in a file, same as your initial requirement).
Using Chef or Puppet will not solve your problem alone, since both need an agent installed on an EC2, you cannot run your agent in the RDS server. So you can have an EC2 using a Chef or Puppet agent, which will in turn launch the MySQL script, but this will not give you much more than the previous solution