How to connect to AWS from codeigniter?

0

It turns out that I am creating web services to be able to consume them afterwards, the issue is that the database is in Amazon Web Services and apparently something prevents me from connecting to it.

Download the zip from codeIgniter.com, unzip it and start configuring it in the config folder / database.php file. Just add the required data:

-hostname:'chompiras.c24z******.us-west-2.rds.amazonaws.com'  
-username:'chompiras'  
-password:'dh7a76a5a******' 
-database: 'chompiras' 

and the dbdriver leave it as it is: 'mysqli' well we know that mysql is out of use.

I would show them my driver code and model but test with the credentials of another database and it works perfect.

where did I upload the folder? to a smart server, (not to AWS) since that is production and it is delicate to work the data, but with the credentials well placed there should be no error!

I do the tests with POST and throws the following:

  

A PHP Error was encountered

     

Severity: Warning

     

Message: mysqli :: real_connect (): (HY000 / 2003): Can not connect to MySQL server on 'chompiras.c24z ******. us-west-2.rds.amazonaws.com' ( 110 "Connection timed out")

     

Filename: mysqli / mysqli_driver.php

     

Line Number: 201

     

Backtrace:

     

File: /home/Chompirasc/public_html/wsatencion/index.php
  Line: 315
  Function: require_once

and also:

  

A Database Error Occurred

     

Unable to connect to your database server using the provided settings.

     

Filename: core / CodeIgniter.php

     

Line Number: 515

    
asked by Hernan Humaña 14.12.2016 в 00:47
source

1 answer

1

Check if the application works locally (on your computer) by pointing to the database. If you manage to connect, make a telnet from the server where the application is hosted:

telnet chompiras.c24z******.us-west-2.rds.amazonaws.com 3306

If the telnet tells you that you can not connect, there must be a firewall rule that prevents communication between these servers. You could try to disable it

Other things that are worth checking: host address, username, password, name of the database and connection port.

    
answered by 31.12.2016 / 03:54
source