I'm using Amazon RDS for the first time ever and I've been following the heroku docs to get my app using the RDS instance. So far I've created an instance and I have setup the addon using the format:
$ heroku addons:add amazon_rds url=mysql://user:pass#rdshostname.amazonaws.com/databasename
After running heroku rake db:migrate I got
!!! The bundled mysql.rb driver rake
aborted! no such file to load -- mysql
So I installed the MySQL gem. Doing the same thing again I got the error:
Can't connect to MySQL server on
'myapp.cqslpaxxqrok.eu-west-1.rds.amazonaws.com'
(110)
I see there's a note about the instance being in the US-east region for Heroku's security group to control access or something. Can I not use a European instance?
No, you cannot use a European instance. Heroku is only available on the US East zone right now, and you need to be able to add Heroku to your security zone for the RDS instance to work, which I suppose require you to be in the same zone. More imporantly, you want to be in the same zone as Heroku for latency and security reasons (otherwise your database traffic will be travelling over the Internet).
Heroku changed its procedure to allow Heroku servers to connect to RDS instances. The accepted answer to this question is not true anymore.
You have to grant Heroku dynos access to your RDS instance. The recommended way to do this is to configure the RDS instance to only accept SSL-encrypted connections and configure the security group for your instance to permit ingress from all IPs.
Previously, Heroku published its AWS account ID and security group name as a way to grant access to an AWS RDS instance. This is no longer recommended.
Ref: https://devcenter.heroku.com/articles/amazon_rds
Related
I'm currently having issues setting up the AWS Explorer plugin in DataGrip to recognise the Aurora Serverless Clusters (MySQL). I have set up credentials from IAM in the credentials file, and can access other AWS services (if I select the dropdown "Schemas", for example, I can see the list of schemas in my org) but clicking the RDS dropdown shows "empty", and doesn't even show the list of database engines. I have tried connecting with secrets manager and using the correct secret for the DB cluster but no luck. When I try and add the database cluster as a data source, it just hangs on "Introspecting" and then the endpoint for that cluster.
I found this issue on the aws-toolkit for jetbrains github https://github.com/aws/aws-toolkit-jetbrains/issues/2124
which mentions that it could be a driver problem. I have tried changing to the mySQL driver, and that hasn't seemed to fix it. DataGrip also seems to heavily encourage using the recommended Aurora MySQL driver.
Is this a bug with DataGrip, or AWS Explorer, or am I missing something obvious? Do I need to enable SSL CAs to get AWS Explorer the correct permissions?
Thanks!
EDIT: I have gone through the prerequisites listed on the AWS docs:
I have installed the AWS CLI and AWS SAM CLI
I have installed Docker (but I haven't set up any containers - I think this is
only needed if I'm running localhost?)
I'm running Windows 10.
Aurora serverless can't be accessed from the internet. From docs:
You must create your Aurora Serverless DB cluster in an Amazon Virtual Private Cloud (Amazon VPC). Aurora Serverless DB clusters are accessible only from an Amazon VPC and can't use a public IP address.
Thus, you need to setup VPN or some proxy (e.g. ssh tunnel through a bastion host) to be able to connect to Aurora serverless from outside of AWS.
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
I have an RDS with multiple read replicas. In order to load balance the available read replicas, I used Route53's weighted hosted zone. I use this link for doing that: AWS Read Replica
After completing the steps provided in this link, I could connect to the RDS locally (after whitelisting my local IP). But when I try to connect to it from an EC2 server, it is giving the error:
ERROR 2005 (HY000): Unknown MySQL server host 'rds-endpoint.com' (0)
I have tried whitelist both the EC2 machine's public and private IPs. Not sure, what is causing the issue.
But, when I tried opening the MySQL port to the public (0.0.0.0/0,::/0), I can connect to it. What is the issue? How can I resolve it.
The server that I used was hosted in the default VPC and the RDS is hosted in another custom VPC. When I created an EC2 instance in the same VPC where the RDS is hosted, the issue resolved. I am able to call both public and private domain name of Route53's hosted zones.
With this, my issue got resolved. Not sure, whether there is any way to connect from other VPC.
Can you install MySQL for AWS Elastic Cloud Compute (EC2) directly on the instance? I can't afford to purchase a separate RDS instance at the moment.
My website is setup on AWS EC2 already and now I'm going to try out some features with a database. I need to set up the instance to run on the EC2 localhost and connect it to my website to store my user data.
So first you need to separate XAMPP from mysql in your thought process. XAMPP is a tool only for your local development. You can set up a database on the Elastic Cloud Compute (EC2) instance similarly to how you set up your XAMPP config locally.
Here are the official docs on how to install a full LAMP stack on an EC2 instance running the Amazon Linux AMI - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html
I have my Sails application on an AWS instance with all dependancies installed with no apparent issues. However, each time I try to launch the app I am getting the following error.
error: AdapterError: Connection is already registered
I have not managed to successfully lift sails yet on the instance and sails-mysql was freshly installed so no connections should be registered.
I have taken the following steps to deploy my app..
Set up a MySql RDS instance (EU-West)
Created and set up an Ubuntu AMD-64 t2.micro EC2 instance (EU-West)
Installed all prerequisites (Git, NVM, NodeJs, Sails, etc.)
Cloned my Sails project
Installed dependencies for Sails
Correctly configured my connection settings for Sails to use my RDS instance.
I know that my connection settings are correct as I have been able to run Sails on my local machine with a connection to my RDS instance and it would consistently lift without any issues.
I am also able to connect to my RDS instance using SequelPro with no problems.
I have had issues with dependencies in the past but have managed to fix those issues and have not had any of them on my local machine or with my EC2 instance.
After searching for a while I have come across a few users who have had similar issues but have managed to fix them with Waterline's teardown methods, however, I am unsure how to achieve this.
I have done my best to provide as much information as possible and any help would be massively appreciated.
Sails Version: 0.12.11
Thank you in advance.
I managed to fix the issue by carrying out the following:
Switched my environment to production in config/bootstrap.js
In connections.js add connectTimeout: 20000 to make sure the request does not time out before the connection is made.
eg. process.env.NODE_ENV = 'development'
Ensure that the security group inbounds rules for the RDS allows connections from the security group associated with my EC2 instance.
Type: MySQL/Aurora
Protocol: TCP
Port Range: 3306
Source: < Your security group ID >
Following the above points also meant I overcame the issue with handshake timeouts when communicating with the RDS.