Move RDS Aurora Instance from private to public subnet - amazon-web-services

I currently have the typical setup of an RDS cluster with 1 instance running in a private subnet. I am migrating our application out of AWS and into Heroku (while leaving the DB as is), but I need to be able to connect to the DB from the Heroku dynos.
What I can't figure out is how to move the DB out of the private subnet and into a public one.
The AWS docs have instructions for moving from public to private, and I thought I could just follow them for the opposite direction too. But the process involves standing up a new secondary in the desired subnet using Multi-AZ configuration and a failover. But when I go to Modify my instance, there is no option for configuring Multi-AZ:
It seems like Aurora instances in particular do not support Multi-AZ? "Multi-AZ DB clusters are in preview for RDS for MySQL and RDS for PostgreSQL" Leaving me somewhat stuck.
Edit I did just see this message elsewhere: "You have no Aurora Replicas in your DB cluster." which might be why Multi-AZ is not available. But I'm not seeing any options to spin up a replica anywhere.
Again my goal is to get my Aurora DB into a public subnet (or otherwise make it accessible from the internet, but not through an SSH tunnel)

The Availability Zone options are in the "Availability & durability" section above "Connectivity" FYI
I just had your same issue but with a Postgres DB, though I have the option to change its "Subnet group" in the Connectivity section, which you don't have it seems, but it only appears for me if the DB is NOT currently multi-AZ. AWS will prevent you from moving the DB between subnet groups* in the same VPC, but you can just move the DB to a subnet group in a different VPC and then move it back to the subnet group that you actually want it in (configured with the appropriate public subnets).
*You can create subnet groups in the RDS service, left side menu.

Related

Connect a Database with an Amazon VPC from local

Just created an VPC for EKS Cluster and started RDS PostgreSQL instance with custom VPC.
Custom VPC has Subnets.
My Custom VPC has Internet Gateway attached.
EKS and RDS is in same VPC so they have internal communication.
My problem is that i want to connect to RDS from my local machine and i am unable. Regarding the problem i have created a new Security Group with Inbound Rules for PostgreSQL.
PostgreSQL TCP 5432 0.0.0.0/0 –
Im still unable to connect
UPDATE
RDS is Publicly accessible
Security group allows access to RDS
In order to connect to RDS instances from the internet you need to do these 3 things
Deploy your RDS instance in a "public" subnet. This means the subnet must have an Internet Gateway attached to it so it can respond properly to outbound requests
In your RDS instance under Connectivity, extend the Additional configuration section, and then choose Publicly accessible.
Make sure the security group allows access to your RDS instance.
Note: exposing a database to public access is not secure. What I recommend you to do is create a proxy with haproxy or a VPN.
To be able to connect to the RDS database remotely you need to select "yes" option for the "Public Accessibility" setting for you database. Here are some additional configurations that need to be taken into account (form AWS docs):
If you want your DB instance in the VPC to be publicly accessible, you
must enable the VPC attributes DNS hostnames and DNS resolution.
Your VPC must have a VPC security group that allows access to the DB
instance.
The CIDR blocks in each of your subnets must be large enough to
accommodate spare IP addresses for Amazon RDS to use during
maintenance activities, including failover and compute scaling.
Best,
Stefan

why is rds in 3 subnets in aws

I haven't changed my vpc/subnet settings since making an aws account, and I've recently found my rds instance is apparently in 3 subnets (subnet is listed as default with 3 subnet names underneath), one of which also has my application server. Is it necessary to have my rds in all 3 subnets? I want to move it to a separate subnet away from the application server and make it private - if that's the case is there anything in particular I will need to do?
Typically, an Amazon RDS instance is running on one server in one subnet.
However, when launching the database, you are asked to provide a Subnet Group, which identifies which subnets the database could launch in. These are typically private subnets within the VPC.
If you are using a Multi-AZ database, then it will use two subnets -- one for the Master (running) database and one for the secondary (standby) database.
It is also possible to create Read Replicas that could be in a different subnet to the Master database.
Bottom line: You are probably viewing the list of subnets in the Subnet Group that it can use, but it is likely to only be in one subnet at the moment.

How can I get kubernetes resources to succesfully connect to an RDS instance in another vpc

Background: I have a kubernetes cluster set up in one AWS account that needs to access data in an RDS MySQL instance in a different account and I can't seem to get the settings correct to allow traffic to flow.
What I've tried so far:
Setup a peering connection between the two VPCs. They are in the same region, us-east-1.
Created Route table entries in each account to point traffic on the corresponding subnet to the peering connection.
Created a security group in the RDS VPC to allow traffic from the kubernetes subnets to access MySql.
Made sure DNS Resolution is enabled on both VPC's.
Kubernetes VPC details (Requester)
This contains 3 EC2's (looks like each has its own subnet) that house my kubernetes cluster. I used EKS to set this up.
The route table rules I set up have the 3 subnets associated, and point the RDS VPC CIDR block at the peering connection.
RDS VPC details (Accepter)
This VPC contains the mysql RDS instance, as well as some other resources. The RDS instance has quite a few VPC security groups assigned to it for access from our office IP's etc. It has Public Accessibility set to true.
I repeated the route table setup (in reverse) and pointed back to the K8s VPC subnet / peering connection.
Testing
To test the connection, I've tried 2 different ways. The application that needs to access mysql is written in node, so I just wrote a test connector and example query and it times out.
I also tried netcat from a terminal in the pod running in the kubernetes cluster.
nc -v {{myclustername}}.us-east-1.rds.amazonaws.com 3306
Which also times out. It seems to be trying to hit the correct mysql instance IP though so I'm not sure if that means my routing rules are working right from the k8s vpc side.
DNS fwd/rev mismatch: ec2-XXX.compute-1.amazonaws.com != ip-{{IP OF MY MYSQL}}.ec2.internal
I'm not sure what steps to take next. Any direction would be greatly appreciated.
Side Note: I've read thru this Kubernetes container connection to RDS instance in separate VPC
I think I understand what's going on there. My CIDR blocks do not conflict with the default K8s ips (10.0...) so my problem seems to be different.
I know this was asked a long time ago, but I just ran into this problem as well.
It turns out I was editing the wrong AWS routing table! When I ran kops to create my cluster, it created a new VPC with its own routing table but also another routing table! I needed to add the peer connection route to the cluster's routing table instead of the VPC's Main routing table.

(AWS) Can't launch RDS in my chosen VPC

I'm following AWS's instructions Scenario 2: VPC with Public and Private Subnets and am having issues at the point I try to launch a DB server.
When I launch my instance, all is fine and I am able to assign it to my newly created VPC. However, when it comes to launch the RDS, the only VPC available (on step 4, configure advanced settings) is the default VPC (ie not the one I created as per their instructions).
Has anyone any idea about this or indeed how to resolve it?
RDS requires a little more setup than an EC2 instance if you want to launch it within a VPC.
Specifically, you need to create:
a DB subnet group within the VPC
a VPC security group for the RDS instance
The documentation is a little buried in the AWS RDS documents. It can be found here:
Creating a DB Instance in a VPC

AWS - moving RDS to VPC

We have couple of RDS that are not added under VPC, so we need to bring them under VPC. Please let me know the steps and downtime expected. Also let me know if there need to be any changes in the webservers, so that everything works fine after RDS is under VPC.
You must have a VPC created before hand that have subnet in atleast two different regions.
After this go and create a "subnet group" for RDS and add two existing subnet in that.
Next take a snapshot of your RDS instance and start a new RDS instance from snapshot in VPC.
That should be it.
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.html#USER_VPC.Non-VPC2VPC - official documentation from Amazon.
Depending on your configuration and if the RDS needs to be accessible from the Internet you will have to check the option "Publicly Accessible" in the creation wizard and (in addition to the subnets mentioned in other answers) ensure that the Security has port for the DB properly enabled (and maybe from 0.0.0.0/0).