I created a Elastic Beanstalk environment which created a EC2 instance and a RDS database.
It created security groups and everything. Also I know the configuration:
DB endpoint: xxxxx Port: 3306 Master username: uuuuu
But I cannot connect to it using mysql neither from inside ec2 or outside it.
I get a connection refused error.
Any help?
In the navigation pane, choose Configuration. In the Instances configuration category, choose Edit. Under EC2 security groups, choose the security group to attach to the instances, in addition to the instance security group that Elastic Beanstalk creates. Choose Apply.
Sign in to the AWS Management Console and open the Amazon RDS console at https://console.aws.amazon.com/rds/ . In the navigation pane, choose Databases to display a list of your DB instances. Choose the name of the DB instance to display its details. On the Connectivity & security tab, copy the endpoint.
You can use Elastic Beanstalk with Amazon Relational Database Service (Amazon RDS) to set up, operate, and scale a relational database.
You can add a DB instance to your environment by using the Elastic Beanstalk console. Open the Elastic Beanstalk console , and in the Regions list, select your AWS Region. In the navigation pane, choose Environments, and then choose the name of your environment from the list.
If you are still having this problem, check out your security groups. I was lost in a similar problem and solved it by allowing connections from the security group that the ec2 instance was running in to the security group the RDS database was running in.
So, if your EC2 instance is in the security group sg-randomec2name and your rds instance is in the security group sg-randomrdsname, edit the inbound rules for sg-randomrdsname to allow connections from sg-randomec2name.
For future viewers, there's now a pretty nice tutorial on how to connect an existing ElasticBeanstalk instance with an existing RDS database (MySQL, etc).
Ideally, you should NOT make the database while setting up the ElasticBeanstalk environment, as this binds the two together and there is currently no way to unbind them without terminating the environment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With