How to connect to EC2 instance within an iOS App

后端 未结 1 1083
迷失自我
迷失自我 2021-01-15 19:11

I have an AWS EC2 instance and an app that I created. The app is for people who get migraines (tracks info, tells them what their trigger(s) are). Now I want to be able to s

相关标签:
1条回答
  • 2021-01-15 19:25

    Should I be doing this differently?

    Absolutely, 100%, YES. You don't want to let people SSH into your server, especially by embedding your private key into an app binary. It's crazy easy for someone to get it, then wreak havoc upon your server.

    Don't do this.

    Instead, I would get a web server like Apache running on your instance (it's trivial), and write an application (in PHP, Rails (with Passenger), Python, whatever) that saves files to the server's hard drive. You'll also want to get an Elastic IP address so that it stays constant, as ashack mentioned.

    In your iOS app, you'll want to send a POST request to your server. See Sending an HTTP POST request on iOS, it's essentially what you're doing now.

    Don't publish your private SSH key. It's private for a good reason.

    0 讨论(0)
提交回复
热议问题