Connect to AWS-RDS MySQL from another aws Ubuntu server - mysql

I am pretty new to aws stack and trying to setup a simple node-mysql app.
Node is running on AWS EC2 Ubuntu 14.04 instance, and MySQL is running on AWS RDS instance.
I am trying to connect to MySQL from my Node client using popular MySQL connector https://github.com/mysqljs/mysql but for some reason always getting 'Connection timeout'. Since node connection doesn't work, I tried to connect using a Telnet just to see if I at least can create any kind of connection.
telnet instance.12345.amazonaws.com 3306
but also unable to connect. Please note both of the connections e.g. though node app and through telnet do work when I try running them from my Windows localhost.
Things I've considered:
EC2 Ubuntu instance has Outbound rules to allow any kind of out
request.
Running app as sudo.
RDS MySQL instance has inbound
port 3306 open.
Installed MySQL client on my EC2 machine.
Basically have no idea on what exact step I've missed during setup and just trying to poke anything possible, any help/suggestion is greatly appreciated.

Related

Not able to connect MySQL server running on docker with Node-Red container

I have a VM (OS: Ubuntu 18.04) running in azure cloud in which I have installed docker. In docker I have two containers MySQL(8.0.20) and node-red(v2.1.3), I am trying to connect my MySQL with node-red and I get the following error message in Node-Red
"Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client"".
MySQL is working fine, I am able to access the database via putty but somehow I am not able to make a successful connection with node-red as well as Grafana.
I am using following configuration. My VM's IP address is 20.107.194.152 and MySQL port is 3306
Can some one tell me what I am doing wrong here. Thanks.

Connecting to MySQL server via kubernetes pod using Intellij

We have a MySQL server that is running on AWS using AWS RDS service and some Kubernetes pods which run some services that connect to this MySQL instance.
I have been using Intellij Idea (2020.1) to connect to these MySQL servers for quite some time. However, recently we have changed the policy to connect to these instances, and now it's only possible to connect to the MySQL servers from the Kubernetes pods. Hence, I now need to login to these pods and then query MySQL using the command-line MySQL-client.
Is there any way I can still use Intellij to connect to these MySQL instances than having to log in to the pods using something like SSH tunnelling or something like that?
Yes, setting up an SSH tunnel is recently straight forwards, but the setup depends on your VPC and EC2 configuration. There are a lot of how-tos on the net, e.g.: https://medium.com/#michalisantoniou6/connect-to-an-aws-rds-using-an-ssh-tunnel-22f3bd597924

MySQL Remote Connection (Replication)

I have the following topology.
One Ubuntu 16.04. Instance on the Amazon AWS where my global MySQL Server is running. I want to use this Server as a Slave (Multi-Source Replication) for many local Master (Windows Machines MySQL Server).
For Testing Reasons I`ve Managed to make this running on one local Machine (with three different MySQL Server Running).
But now I want to make this Replication work on the mentioned global Server with the local ones. But it fails on the attempt to connect from the EC2 ubuntu Instance to the local Windows MySQL Server.
When I try to connect from my EC2 Instance to the local Computer with MySQL running on Port 3307 it keep saying:
ERROR 2003 (HY000): Can't connect to MySQL server on (113)
The strange Part is, that I can PING the Local Computer but not telnet it.
Telnet just says:
telnet: Unable to connect to remote host: No route to host
I can access the Global (EC2 / Ubuntu MySQL Server) from the local Machine but not the other way around.
I`ve already made a new Rule for this Port on the Windows Firewall Settings.
But the Port 3307 on the IPv4 Address seems to be still Closed.
I have no clue what I am missing to get a Connection from the EC2 Instance to my local Computer via TCP.
Do I have to open the Port Specific on the Router?
I hope for your help.
Best Regards.
It seems like your local computer is not visible, as your incoming ports to your local pc are closed. It may be a problem with your router, or your internet service provider, which is not allowing you to open ports(the most common one).
The possible solutions are:
1.) If your ports are not open due to the router
Try forwarding required ports to your pc.
Try Switching off your NAT firewall that may be blocking ports.
Try switching off your windows or antivirus firewall if any.
2.) If your ports are blocked by your Internet service provider.
Try getting help from ISP
Switch to a static IP connection if on dynamic.
Use a VPN service that provides an unblocked port service to all IPs.(This one solved my problem when I was struck in this situation.)

Custom Amazon EC2 instance and managing MySQL

so I've made an instance at amazon free web service, I've installed through putty mysql, php5, apache and so on on an ubuntu instance... But I can't for the life of me seem to find out how to manage the mysql on that instance. What am I missing? If I look in the Amazon RDS I can only manage for another instance, not for the one I have custom running...
As you have installed MySQL in the EC2 instance you can manage it via terminal.
Login to your instance using putty/ssh and connect to MySQL using below command
mysql --user=username --password=password
you need to install MySQL client if you installed on only MySQL Server.
If I look in the Amazon RDS I can only manage for another instance, not for the one I have custom running...
Yes, RDS is a service where Amazon manages the entire database box for you. The AWS Console manages (paid) RDS instances, not databases in general.
But I can't for the life of me seem to find out how to manage the mysql on that instance.
The "normal" way. Amazon doesn't come with CPanel or other GUI administration tools. Mainly because experts don't need them.
If you want to manage your MySQL graphically, install something like PHPMySQLAdmin or the like.
Note: never open the MySQL port to the internet. If you need to connect to MySQL, use "port forwarding" in Putty to forward port 3306 to the remote box port 3306. Then you can run a MySQL GUI client locally.

Connect Amazon EC2 to my Local MySQL Database

Is it possible to do the following?:
I have a local Mac running OS X Lion with a MySQL Server installed which runs different processes regularly and stores data into a local DB.
On the other hand I have an Amazon EC2 instance.
What I would like to do is to use the Amazon instance to perform certain cronjobs (using its own resources) but connecting to the data that is on my localhost (my computer) and performing basic SQL actions like updating the data, inserting, etc.
I don't know if this helps, but I have a static IP. Is there any way I can "open" my IP so the Amazon instance can recognize my home computer as a valid MySQL server?
Thanks for your help, any tip in the right direction will be much appreciated.
If your EC2 instance is connecting to your local db you'll need a static IP locally. Well not need... but if you don't have it anytime you reset your router or loose power etc your ip will change. You can look into Dynamic DNS as well for your local instance.
Your ISP will not block your port on your local instance. This would be a firewall inside your network that is preventing you from connecting to mysql or a configuration with mysql itself. Users can only connect to mysql from certain IP addresses.
You would have to open up the mysql port on your firewall if you are using one, have the mysql client installed on your EC2 instance, and make sure that the user that had proper grantable permissions.
That said why not run cron locally on the mac?
If you can login to your server via SSH then there's no need to open any other port and no static IP is required. You can use SSH port forwarding instead. From your local machine run:
ssh -C -R 5555:127.0.0.1:3306 <your-server-host>
Now you should be able to connect to your Mac's database running on localhost:3306 from the remote server at localhost:5555.