Connect to Amazon EC2 instance from ios app

I am trying to make an ios application that uses Amazon Web Services as its backend. I have a MySQL database in RDS and you want to query this database from the application in order to get the content for the application. After some research, it seems like I should approach this by adding my own API to query the database for an EC2 instance. Then, instead of directly accessing the RDS instance from the application, I access the API on the EC2 instance, which accesses the RDS instance for me. First, is that the way? I am also open to other suggestions.

Here is what I have done so far by reading this post:

  • Installed apache and php for my EC2 instance.
  • Got an elastic IP for my EC2 instance.
  • Added a file (call it retrieve-data.php) in apache, which uses my endpoint, username and password for RDS to query the database and return data.

In my ios application, I can send elastic_ip_address_of_my_ec2_instance / retrieve-data.php http request to get data from my RDS database in my application. Is that the way? Could this be improved in any way?

+4
source share
2 answers

For those who may find this useful, the following is a brief description of the steps you can take to set everything up.

Setup:

The following steps describe three options:

A = domain name NO, no load balancing

B = YES,

C = YES, YES

  • (A + B + C) EC2.
  • (A + B + C) . , apache2 (), , . php.
  • (A + B) , EC2 , , IP- . AWS. (C) , IP-. . namecheap.com. ( 2015 ) .xyz TLD 1,18 .
  • (A + B + C) - apache, EC2, 2.
  • (B + C) Amazon 53. . 53 AWS . . ( B) () 53, IP EC2.
  • (B + C) 3-5 . 53 5. , .
  • (C) EC2 AWS. .
  • (C) 53, .

EC2

, php script myscript.php, 4. script EC2 , :

A. - : elastic_IP_of_your_EC2_instance/myscript.php

B + C - - : yourdomain.com/myscript.php

, !

+2

: , ;

- , amazon RDS iOS, - EC2 -, RDS . - -, . RestKit EC2: github.com/RestKit/RestKit

+3

All Articles