简体   繁体   English

如何将 EC2 实例连接到 Android 应用程序?

[英]How do I Connect EC2 instance to Android App?

I'm developing an Android App and I want the users to upload some images to an EC2 instance in order to process them using some fancy python code, and then return the final images to the user.我正在开发一个 Android 应用程序,我希望用户将一些图像上传到 EC2 实例,以便使用一些花哨的 python 代码处理它们,然后将最终图像返回给用户。 I am new with servers and AWS, it's a little bit confusing, there are too much things that seem related, but I am not sure where to look.我是服务器和 AWS 的新手,这有点令人困惑,似乎相关的东西太多了,但我不知道该去哪里找。 What can I do to achieve my goal?我能做些什么来实现我的目标? Thanks.谢谢。

Long story short, I am gonna put things into the list in sequential order to make things easier for you.长话短说,我将按顺序将内容放入列表中,以使您更轻松。

  1. Spin off an EC2 instance (Instance class as per your CPU/Network/Memory Requirements).分拆 EC2 实例(实例类根据您的 CPU/网络/内存要求)。
  2. Install required dependencies and Publish code into your EC2 Instance (Via GitHub or CI/CD. Github will be a straightforward way for you as a beginner.)安装所需的依赖项并将代码发布到您的 EC2 实例中(通过 GitHub 或 CI/CD。对于初学者来说,Github 将是一种直接的方式。)
  3. Run your code.运行你的代码。
  4. Configure security groups which will allow the internet to communicate with your instance.配置允许 Internet 与您的实例通信的安全组。 Security groups help you define which port to open to the internet and make it accessible from your android app.安全组可帮助您定义要向 Internet 开放的端口并使其可以从您的 Android 应用程序访问。
  5. Connect your code via EC2 IP or public IP domain exposed by every EC2 instance (If configured with the public IP option).通过每个 EC2 实例公开的 EC2 IP 或公共 IP 域连接您的代码(如果配置了公共 IP 选项)。

These are the basic things you need to do for a simple DIY set-up as a beginner.这些是您作为初学者进行简单 DIY 设置所需要做的基本事情。 This will be a good start but definitely not recommended for production usage.这将是一个好的开始,但绝对不推荐用于生产用途。 For production usage, you need to familiarise yourself with the concept of VPCs, Subnets, NATs, IGWs, Security Groups, Load Balancers, AutoScaling Groups, ACM for SSL certificate management and Cloudwatch for alerting and logging.对于生产用途,您需要熟悉 VPC、子网、NAT、IGW、安全组、负载均衡器、AutoScaling 组、用于 SSL 证书管理的 ACM 以及用于警报和日志记录的 Cloudwatch 的概念。

I hope this will help you to kickstart.我希望这将帮助您启动。

Note: If you are a beginner and this is just a hobby learning project then I would recommend not to get into advanced concepts like VPCs, subnets etc. and start with humble beginnings.注意:如果您是初学者并且这只是一个爱好学习项目,那么我建议您不要进入 VPC、子网等高级概念,而是从卑微的起点开始。 Once you achieve that, look into more security + availability of your existing setup.实现这一目标后,请查看现有设置的更多安全性和可用性。 Do things in smaller increments rather than everything all at once.以较小的增量做事,而不是一次完成所有事情。 Happy Coding.快乐编码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM