How do I create an AWS server that could recieve data continously from an IOS(swift) app? - ios

I am trying to code an IOS application and already have an ec2 server designated for the app. I want to know how the app could send image data to the server. The ec2 server would receive incoming image data continuously from all the users that use the app. The server would then process the data. It would be similar to what applications such as Instagram do but, of course not at such a large scale.
I am a beginner at client-server communication and want to know how to implement this into my app. I also do not use stack overflow too frequently, so please tell me if I am doing something wrong if you need more information.
To be more specific, a user would post an image in the app. I currently have already set up an ec2 server to possibly receive that image. I want all of the images that users post to be delivered, processed, then stored in the ec2 server. Is there some way to handle the actual delivery of data. The question is a little broad because I want to know where to look. Would I have to write a script that is constantly running in the background and receiving data at some port? Is there another service I could use that handles this?

Um, briefly, you'll have issues with running on an EC2 if you have many users sending images at the same time.
Look into setting up API Gateway <-> Lambda <-> DynamoDB or S3 on AWS. Then your client can POST images/data to your gateway with a HTTP request.

First you must decide if your data is streaming (continuously pushed from server) or stored (pulled from the server as needed). The Instagram example you provided suggest that you have no need for real-time streaming data.
A streaming solution is more complicated and may typically require a technology like web sockets (or AWS IoT) to accomplish. A storage solution will be much simpler.
For storing you have the choice between creating and managing server(s) using a platform like EC2 (you'll need more than one server to scale to many users), or using managed 'serverless' technology like Lamba where you only need provide the code. The tradeoff is for this convenience is usually price.
For image storage, a typical pattern is creating database records that contain an S3 URL for the underlying image (as well as any metadata). You can create this database record and upload your file using whatever server technology you choose; Lambda may require an API Gateway server but remember that the AWS SDK can invoke Lambda functions directly.

Related

Backend for iOS

I need a backend to store location updates and messages, I was thinking of using JSON to connect to the Amazon S3 server and to fetch and store data.
How many clients could be connected to this server? Is there a way to link a MYSQL server to Amazon S3 for login and users accounts?
S3 is not a database store; you write/delete/replace an entire object.
You want AWS RDS. Amazon manages the DB (MySQL supported). Skim the reference architectures for something applicable to your needs. Scale them down; they're designed to make use of as many AWS services as possible.
http://aws.amazon.com/rds/
http://aws.amazon.com/architecture/
Other option is Amazon Dynamo DB. This is an infinite-scale nosql db with a fully managed REST API. You dont worry about the data size growth, speed etc. AWS take care of all these.
http://aws.amazon.com/dynamodb/.
Even in this case, you need to have some code running in the backend, which receives your REST calls from the iOS and writes to the Dynamo.
Other even easier solutions are https://parse.com/ and https://www.firebase.com/
These are solutions specifically for your kind of needs - Make a mobile backend Datastore. They give client SDK, which has a very great value in terms of offline synch. You just invoke the SDK from the apps and will synch with the backend datasore when the connections are available - reduces your code complexity a lot !

iOS app database and cloud storage

If I want to setup a database for an iOS app, and kind of make the app work in a sort of MVC style, is this possible through iOS alone, or do I need to create a web application to handle database interaction etc?
I would really like to be able to set up cloud storage/databasing directly from an iOS app. Is this possible? Does Apple have a platform for this, or do I need my own server?
In iOS the work with a web based services is very easy but on the other hand: need a "connection file".
it works like this:
the iphone has the info > sends it to a php/asp/asp.net/server side page, this page is taking (by "get" or "post") the info sent and than inserts it into the database, saves the file on the server and etc..
For reciving content from a web based service you also need a server side file to handle your trafic to the database, but now the output you get is in JSON.
you get back to the app an array (the file sends the array back) and than you use the array for handeling the conent you just got.
It may sound very hard but it is not as much as it seems. For your questions: there is not a way to connect directly through the app to a Cloud DataBase.
Now, when talking about owning a server and so: there are not so many companies which provide a cloud databse alone. but even if you get a cloud data base you can always host a domain somewhere cheap and the pages are only a few KB in weight any way...
And those files will be for connecting to the DataBase (The middle-men for the app).
That is a short explanation about connecting to web based services in iOS Developing.

How to create a server accessible by an iphone app

I a thinking of creating an iPhone/iOS app that would include a feature where one user could create a list of words and then save them to their account on a server. Also (and this is very important), the user could share their list with other users by giving them permission.
So my question is, how can I go about creating such a server? For right now, I have a home computer (running Windows XP that just stores data for my music system) which I can use to host the server. I am also open to the use of other online storage services like Google Drive or Dropbox (I can't remember if Amazon does anything like that). However (and I know this may complicate things a bit), but at least for now, I want/need to stick with free services/options.
Just to recap, the key features that I am looking for are:
create users/accounts (on the server)
eventually I may [try] to incorporate the use of other services to log users in like with their email account, OpenId, etc.
the ability to access (log in to) the server (with credentials) from my app
the ability to send/receive data between the server and my app
the ability to share data between users
I know this is a lot to ask for, but if anyone has any suggestions or can get me going in the right direction, it would be much appreciated.
The basic setup would be as follows:
Backend: Database (MySQL), Web server (Apache), with server side scripting (PHP).
Client: iOS device with developed app.
Communication: use HTTP client/server model, communicating with something like JSON.
This is much the same setup as a web server, but instead of serving html/css/javascript etc the results will be JSON.
As far as implementing specifics such as login in, and sharing data between users, this is purely dependent on your implementation. This is not trivial, and not something that can be easily stated in a single post.
Hope this helps.
You could build your own webservice in PHP, Ruby or Python. If you do so I would recommend building a RESTful webservice (http://en.wikipedia.org/wiki/Representational_state_transfer) and then use RestKit (http://restkit.org/) to handle the data in the iOS app. Especially RestKit's CoreData integration is nice in my opinion.
Another solution would be using a service like Parse (https://parse.com/products/data). The first million or so requests per month are free but after that it could get pricy. I personally have not tried it so I couldn't tell you if it is any good.

How to sync app data across multiple i-devices?

I am new to iOS app development and am interested in developing an app that needs to utilize existing technologies to sync app specific data across multiple i-devices (iPhone, iPad, Touch, etc.). As an example, the app can be installed on multiple devices. On one device, the user will initially create an account. Then in subsequent logins, the user may create a task list, and each task item may possibly include a captured photo image. On the user's second i-device, as he logs in, he would be able to see and access the list and images (locally). Can someone explain to me what technologies I can leverage on to implement such an app?
Specifically:
How do I set up and manage the user accounts? Do I Need a dedicated server and sql database set up for my entire user base? And what programming/scripting languages do I need to learn?
How about the mechanism of pushing and pulling app data from one device to another? Do I need some kind of cloud technologies (SaaS?) to handle the storage and transferring of the data?
Any specific open source or commercial products I can leverage on?
Thanks in advance.
Kenny
I personally have not have had a situation like this, but here is what I would recommend.
You will need to have a server set up with database software.
You will need to write an api for yourself based on HTTP POST (REST) or maybe you could write a SOAP service.
I would HIGHLY recommend purchasing an SSL cert. for your server that way you can send the username and password in your request and it will be encrypted automatically.
For the api, you have a whole selection of languages and databases at your disposal. I am personally biased towards asp net with an MSSQL server.
with your api you will need to write methods to authenticate the user, and then save and send your data.
In your app you will simply send web requests to the server (ASIHttpRequest maybe?) and you can receive JSON responses back, which you can then deserialize into workable objects and vice versa.
if you do use asp net, you can use the newtonsoft JSON library to convert your objects for sending and convert received objects.
I dont remember the name, but there also is a JSON library for obj-c that is usable on iPhone.
Use a SQL server and host a database of logins and passwords.
Then, from each device, create a connection to the server, and download the login information for the account.
Also, not to be rude but: Google it.

Setting up a file server for integration with iOS apps

I need to set up a server so that files can be uploaded from an iOS app. I don't know how best to proceed. I thought about FTP but not sure if there is a better option.
any ideas appreciated
GC
Also I must add that I will be building the iOS app so can use server APIs in my code.
It's not ideal to set up a blind File/FTP server and hardcode the details into your app because all it takes is one person to intercept the login details and they have access to your server where they can upload (and potentially execute) bad things.
A possible idea could be to set up an API frontend on your server in a language of your choice (PHP, Ruby, Python or similar) where you can 'POST' images to the server. With the API frontend, you can also do validation to ensure that only valid images are being uploaded and all nefarious stuff is thrown away. Then, in your iOS app, you can set up code to interact with your API frontend and send the actual images which will then be stored on your server.
This is a fairly conceptual idea rather than an absolute implementation idea. It does require some thinking/reading and more setup/coding on the server side.
Edit: Just to add, if you only want a central location to store/get your images without controlling it on a per user basis then you may want to look into Amazon S3 as a File Server.

Resources