如何将文件从iPhone传输到EC2实例或EBS?

时间:2022-03-20 11:19:47

I am trying to create an iOS app, which will transfer the files from an iPhone to a server, process them there, and return the result to the app instantly.

我正在尝试创建一个iOS应用程序,它将文件从iPhone传输到服务器,在那里处理它们,并立即将结果返回给应用程序。

I have noticed that AWS offers an SDK to transfer files from iOS app to S3, but not to EC2 (or at least to EBS which can be attached to EC2). I wonder why I have to go through S3, when my business logic doesn't warrant storage of files. I have used file system softwares such as s3cmd and s3fs to connect to S3 from EC2, but they are very slow at transferring files to EC2. I am concerned that the route through S3 will kill time, especially when the users expect result in a split second.

我注意到AWS提供了一个SDK,用于将文件从iOS应用程序传输到S3,但不能传输到EC2(或至少可以连接到EC2的EBS)。我想知道为什么我必须通过S3,当我的业务逻辑不保证文件的存储。我已经使用s3cmd和s3fs等文件系统软件从EC2连接到S3,但它们在将文件传输到EC2时速度非常慢。我担心通过S3的路由会消耗时间,特别是当用户期望导致瞬间结束时。

Could you please guide me on how can I bypass the S3 route to transfer files in real time from iOS app to EC2 (or EBS)?

您能否指导我如何绕过S3路由从iOS应用程序实时传输文件到EC2(或EBS)?

2 个解决方案

#1


0  

Allowing an app to write directly to an instance file system is a non starter, short of treating it as a network drive which would be pretty convoluted, not to mention the security issues youll almost certainly have. This really is what s3 is there for. You say you are seeing bad performance between ec2 and s3, this does not sound at all right, this will be an internal datacenter connection which would be at the very least several orders of magnitude faster than a connection from a mobile device to the amazon datacentre. Are you sure you created your bucket and instance in the same region? Alternatively it might be the clients you're using, dont try and setup file system access, just use the aws cli.

允许应用程序直接写入实例文件系统是一个非首发,不能将其视为一个非常复杂的网络驱动器,更不用说你几乎肯定会遇到的安全问题。这真的是s3的用途。你说你看到ec2和s3之间的性能不好,这听起来不是很好,这将是一个内部数据中心连接,至少要比从移动设备到亚马逊数据中心的连接快几个数量级。 。您确定在同一地区创建了存储桶和实例吗?或者它可能是您正在使用的客户端,不要尝试设置文件系统访问权限,只需使用aws cli。

If you are really tied to the idea of going direct to the ec2 instance you will need to do it via some network connection, either by running a web server or perhaps using some variety of copy over ssh if that is available on ios. It does seem pointless to set this up when s3 has already done it for you. Finally depending on how big the files are you may be able to get away with sqs or some kind of database store.

如果你真的想要直接进入ec2实例,你需要通过一些网络连接,通过运行Web服务器,或者如果在ios上可用,可以使用ssh上的各种复制。当s3已经为你完成它时,设置它似乎毫无意义。最后,根据文件的大小,您可以使用sqs或某种数据库存储。

#2


0  

It's okay being a newbie!! I ran up against exactly the same processing problem and solved it by running a series of load-balanced webservers where the mobile calls an upload utility, uploads the file, processes it, and then deploys the results to s3 using a signed URL which the mobile can display. It is fast, reliable and secure. The results are cached using CloudFront so once written, are blazing fast to re-access on the mobile. hope this helps.

可以成为新手!我遇到了完全相同的处理问题并通过运行一系列负载均衡的Web服务器来解决它,其中移动设备调用上传实用程序,上传文件,处理它,然后使用移动设备的签名URL将结果部署到s3可以显示。它快速,可靠,安全。结果使用CloudFront进行缓存,因此一旦编写,就可以快速重新访问移动设备。希望这可以帮助。

#1


0  

Allowing an app to write directly to an instance file system is a non starter, short of treating it as a network drive which would be pretty convoluted, not to mention the security issues youll almost certainly have. This really is what s3 is there for. You say you are seeing bad performance between ec2 and s3, this does not sound at all right, this will be an internal datacenter connection which would be at the very least several orders of magnitude faster than a connection from a mobile device to the amazon datacentre. Are you sure you created your bucket and instance in the same region? Alternatively it might be the clients you're using, dont try and setup file system access, just use the aws cli.

允许应用程序直接写入实例文件系统是一个非首发,不能将其视为一个非常复杂的网络驱动器,更不用说你几乎肯定会遇到的安全问题。这真的是s3的用途。你说你看到ec2和s3之间的性能不好,这听起来不是很好,这将是一个内部数据中心连接,至少要比从移动设备到亚马逊数据中心的连接快几个数量级。 。您确定在同一地区创建了存储桶和实例吗?或者它可能是您正在使用的客户端,不要尝试设置文件系统访问权限,只需使用aws cli。

If you are really tied to the idea of going direct to the ec2 instance you will need to do it via some network connection, either by running a web server or perhaps using some variety of copy over ssh if that is available on ios. It does seem pointless to set this up when s3 has already done it for you. Finally depending on how big the files are you may be able to get away with sqs or some kind of database store.

如果你真的想要直接进入ec2实例,你需要通过一些网络连接,通过运行Web服务器,或者如果在ios上可用,可以使用ssh上的各种复制。当s3已经为你完成它时,设置它似乎毫无意义。最后,根据文件的大小,您可以使用sqs或某种数据库存储。

#2


0  

It's okay being a newbie!! I ran up against exactly the same processing problem and solved it by running a series of load-balanced webservers where the mobile calls an upload utility, uploads the file, processes it, and then deploys the results to s3 using a signed URL which the mobile can display. It is fast, reliable and secure. The results are cached using CloudFront so once written, are blazing fast to re-access on the mobile. hope this helps.

可以成为新手!我遇到了完全相同的处理问题并通过运行一系列负载均衡的Web服务器来解决它,其中移动设备调用上传实用程序,上传文件,处理它,然后使用移动设备的签名URL将结果部署到s3可以显示。它快速,可靠,安全。结果使用CloudFront进行缓存,因此一旦编写,就可以快速重新访问移动设备。希望这可以帮助。