[英]how to connect web application deployed on elastic benstalk with mysql database instance on aws?
I have a web application deployed on elastic beanstalk. 我在弹性beantalk上部署了一个Web应用程序。 I have configured MySQL database for it. 我已经为其配置了MySQL数据库。 In database instance in security group i have done following changes: Type(MYSQL/Aurora), protocol(TCP), port range(3306) and source(0.0.0.0/0). 在安全组的数据库实例中,我进行了以下更改:类型(MYSQL / Aurora),协议(TCP),端口范围(3306)和源(0.0.0.0/0)。 when i am trying to insert data into database using web application or fetch data from database using web application which is deployed on elastic beanstalk, i am not able to do it. 当我尝试使用Web应用程序将数据插入数据库或使用部署在弹性beantalk上的Web应用程序从数据库中获取数据时,我无法做到。 I have made changes in servlet code as mentioned on aws website but connection is not establishing between web application and RDS on aws. 我已经对aws网站上提到的servlet代码进行了更改,但是在aws上的Web应用程序和RDS之间没有建立连接。 I don't know where i am doing the mistake. 我不知道我在哪里做错。 please help me to achieve it. 请帮助我实现它。
Please follow the below steps to connect the mysql instance from web application: 请按照以下步骤从Web应用程序连接mysql实例:
Use mysql to connect to the RDS instance using the following command: 使用mysql通过以下命令连接到RDS实例:
mysql -u username -p -h HOSTNAME mysql -u用户名-p -h主机名
where HOSTNAME is the endpoint of your RDS instance. 其中HOSTNAME是您的RDS实例的端点。
Also, you have mentioned you have inbound all the traffic in the VPC security groups. 另外,您提到您已经入站了VPC安全组中的所有流量。 This is not the recommended way to connect to a database.Database should always be secured from the outside world. 这不是推荐的连接数据库的方法。数据库应始终与外界隔离。 You have to explicitly mention the source from where the connections will be coming. 您必须明确提及连接的来源。
Eg: 例如:
Type Protocol Port Range Source 类型协议端口范围源
MySQL/Aurora TCP 3306 security group id of the application 应用程序的MySQL / Aurora TCP 3306安全组ID
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.