DEV Community

Cover image for Accessing Amazon RDS From AWS EKS

Accessing Amazon RDS From AWS EKS

Ben Sooraj on October 09, 2019

Contents Premise Setup the MySQL Database - Amazon RDS Create the VPC Create the subnets Create the DB subnet group Create ...
Collapse
 
ronenmagid profile image
Ronen Magid • Edited

Excellent tutorial. I was struggling for over a day to build simple RDS connectivity from my EKS pods to an RDS outside the EKS VPC. With your clarity, I understood where I went wrong and corrected it. Thanks for sharing!

Collapse
 
dlobatog profile image
Daniel Lobato García

Same here - I struggled a lot trying to create the EKS in the same VPC but the peering connection worked like a charm. Thank you Ben!

Collapse
 
bensooraj profile image
Ben Sooraj • Edited

I know this is late, but I am really happy that it helped!

Collapse
 
bensooraj profile image
Ben Sooraj

I am glad it helped!

Collapse
 
saikatharryc profile image
Saikat Chakrabortty

Thanks for sharing this whole thing.
I have a question, I have followed the whole process, but, it did not work for me.
although instead wrapping that up with service and use that I'm directly trying to access like this:

nc bh.cvcmxxxxxxnouu.us-west-2.rds.amazonaws.com 3306
^Cpunt!

which does not work, any idea?

Collapse
 
ldanilo profile image
Luis Danilo

Hello! Thanks for sharing!
I have a question, why it is needed to have the RDS databases and the EKS cluster in separated VPCs? I previuosly created a EKS cluster using eksctl, it created a VPC with 4 subnets, so what I've tried was to create two additional subnets, include them into default route table of VPC, create a subnet group for RDS and finally create the database, but I am unable to connect to database (I checked security groups thousand of times). Perhaps RDS databases must be in a separated VPC as demostrated in this post?
Thanks again!

Collapse
 
ldanilo profile image
Luis Danilo

Me again! After a exhaustive review I noticed that route tables created by eksctl was divided by public, private and default. I initially included additional subnets into default route table, I just changed said subnets associations so now "public route table" (the one that has attached an internet gateway) includes subnets added by ekctl and my two additional subnets, after that I was able to connect to my database!
But my question is still the same: It is needed to have separated VPCs for EKS cluster and RDS databases? or its more a personal choice?

Collapse
 
dazrg profile image
rodageve

Great article! Thanks. Don't forget to enable DNS name resolution on your VPC Peering connection - this was the additional trick that got my set up working.

Collapse
 
bensooraj profile image
Ben Sooraj

I am super glad it helped!

Collapse
 
helenanders26 profile image
Helen Anderson

This was such a great post, thanks for putting so much working into a really clear example.

Collapse
 
bensooraj profile image
Ben Sooraj

Hey Helen! Thank you so much for the kind words.

Collapse
 
hayderimran7 profile image
Imran Hayder

loved this clean and clear tutorial - based on it i have created a script to automate the vpc peering between EKS and RDS :) gist.github.com/hayderimran7/0eb7c...

Collapse
 
bensooraj profile image
Ben Sooraj

Thank you so much! I am glad it helped. I should write more :D

Collapse
 
form1ca profile image
Formica

ничего не понятно
часть материала из браузера, часть из скриптов///

Collapse
 
mohit_sharmadevops profile image
mohit sharma

Thanks, it worked like a charm