AWS Ubuntu Server with MySQL - mysql

I am currently running AWS ubuntu server to run some scrapers and selenium webdriver. I store all the data into MySQL database in the AWS. Is there a way to use my local mySQL workbench to remotely connect to AWS database.

Yes. You need to fist give your IP access to the security group that your Mysql EC2 is in. In the EC2 console, in the row that has your Mysql EC2, you will see a column for security group... click on the security group. You will then be able to add an entry into the security group's ACL to allow your IP address (the IP address of where the mysql workbench is located) access. Here is a link that goes into more details.
Once you have given your IP address access, you can point your workbench to the hostname of the EC2 instance that has mysql on it.

Related

Add user to RDS instance - MySQL DB

I'm not used to AWS and how some services actually work but in this exact moment I need to add some users to a MySQL database (RDS service) and allow some IPs to access it, and if someone can help me I really appreciate.
I did some research and found that I can connect to the EC2 instance and access the CLI and that would be enough, but I can't find any running instance in any region.
Thanks for your time.
Connect to your RDS instance as the root user, and add an account just like you would with a MySQL database running anywhere else. There is no special AWS procedure here.
If the database has the "publicly accessible" flag enabled, then you just need to add the IP address to the inbound rules in the Security Group assigned to the RDS instance. If the database is not "publicly accessible" then you won't be able to give access to external IP addresses.

How to connect Google Data Studio with AWS RDS MySQL behind VPC?

I have a AWS RDS MySQL database hosted inside VPC. I am having problem with connecting Google Data Studio since it's obviously outside the VPC.
I have enabled Publicly Accessed option in the RDS but still can't connect, even from MySQL Workbench.
Anyone has successfully connect between AWS RDS MySQL inside VPC and Google Data Studio? What's the setup and configuration?
I have posted a similar question to connect MySQL & Google Data Studio (while having SSL enabled). My latter question still needs to be answered, but I actually got MySQL Workbench to work with our AWS RDS MySQL-DB.
Steps:
Add SSL access to the AWS's MySQL database user as recommended in the documentation: GRANT USAGE ON *.* TO 'encrypted_user'#'%' REQUIRE SSL;
Add your current IP address to the AWS instance's firewall-whitelist, to allow for remote MySQL DB access.
Add hostname, port (3306), encrypted_user (created above) and password.

Connecting Securely to MySQL Database on an Amazon EC2 instance from another EC2 instance

I'd like to connect to a mysql database on an AWS EC2 instance from another EC2 instance, but I don't want this mysql database to be accessible from other IP addresses. Changing the bind-address in my.conf to 0.0.0.0 allows everybody to access it, and I don't feel comfortable doing this.
What's the best approach on AWS to configure this in a secure way?
It is easy to do the above. Lets say EC2-1 is your instance and EC2-2 is your MYSQL instance with Security group 1 for EC2-1 and Security group 2 for EC2-2. Add below rule in your Security Group 2. So you can only connect to MYSQL running on EC2-2 from EC2-1 and no body else can connect.

How to browse data in MySQL database on Amazon EC2?

I deployed my Rails app to Amazon EC2 server (Ubuntu), but I am thinking how to connect to MySQL database from terminal (SSL) and manually check data in database.
How to do that? I see in the database.yml file some credentials, but don't know how to connect/log in into MySQL on EC2 instance.
Thanks
There's no special magic involved here. An EC2 server is just... a server. This is not hosting like heroku or godaddy where your database is going to be hosted on a different db server.
Unless you explicitly setup a separate db server (which I don't think you did), you've got an entire virtual machine running Ubuntu, and the db server is most likely running on the same machine.
So you can ssh into the machine and just run the standard mysql client. Docs here: http://dev.mysql.com/doc/refman/5.6/en/mysql.html.
If you want to use some gui software such as sequel pro mentioned in one of the comments, you'll need to open up the ports in the aws console. Amazon closes all the ports by default. Do this to open up the port:
Open up the AWS control panel
Go to 'Security Groups'
Select the security group in the panel (you probably only have one).
Click the 'Inbound' tab.
Select Mysql from the dropdown list
Save the rule
This will open up port 3306 and enable you to use an external tool to see the server.
If you just want to call some sql to the database just to verify small amount of data, you can try doing these:
sql_statement = 'SELECT * FROM users'
ActiveRecord::Base.connection.execute(sql_statement).to_a

Configuring Play Application for MYSQL Database in Amazon EC2

I am trying to use a mysql database in my play 1.2.4 application hosted in Amazon EC2 .
For that, I configured application.conf file with the following snippet in my local environment.
db=mysql:root:password#databasename
and this works fine.
Same mysql server have been configured in my EC2 instance with same Database created .
What should be the configuration to use that DB in EC2 . After several trial and error methods , I am not able to make my Play application talk with the database .
Thanks in advance .
I would diagnose this problem with the following tests:
Can you reach your mysql server from the same machine you are running your application from?
When trying this, make sure that you use the same user and password as in your application.
Have a look at the mysql users table and check if the user is allowed to connect.
Is the mysql daemon bound to localhost or do you have to use the IP or external DNS name of the machine?
Try checking your firewall rules that the port for mysql is open from your application machine
Also check the EC2 Security group that the mysql port is open from your application machine.