简体   繁体   English

AWS:从Elastic beanstalk应用程序访问S3

[英]AWS: Access S3 from Elastic beanstalk application

I have a PHP application which takes inputs from users and writes them to files using normal file operations like fopen, fwrite etc. It works well on my server. 我有一个PHP应用程序,可以从用户那里获取输入,并使用常规文件操作(例如fopen, fwrite等)将其写入文件。它在我的服务器上运行良好。 If I migrate this whole code to Amazon's Cloud and use it's services, how do I map these file operations to corresponding operations on Beanstalk? 如果我将整个代码迁移到Amazon的Cloud并使用它的服务,如何将这些文件操作映射到Beanstalk上的相应操作?

Will the file operations work as they are, without change? 文件操作是否可以按原样工作而无需更改?
If yes, where will these files be store? 如果是,这些文件将存储在哪里?
If no, what's the alternative? 如果没有,那有什么选择?

Thanks for your help!! 谢谢你的帮助!!

You should consider looking into the S3 Stream Wrapper included with the official AWS SDK for PHP . 您应该考虑研究正式的PHP专用AWS开发工具包随附的S3 Stream Wrapper Registering the stream wrapper allows you to work with the S3 using PHP's native file functions. 注册流包装器后,您就可以使用PHP的本机文件功能来使用S3。

You can mount a S3 bucket as a partition and work with S3 files as they where located on your server's HDD. 您可以将S3存储桶挂载为分区,并可以将S3文件放置在服务器HDD上。

I'm the lead developer and maintainer of Open source project RioFS project: an userspace filesystem to mount Amazon S3 buckets. 我是开源项目RioFS项目的首席开发人员和维护者:一个用于安装Amazon S3存储桶的用户空间文件系统。 You can use our project to mount and operate with files using PHP or any other programming language. 您可以使用我们的项目使用PHP或任何其他编程语言来挂载文件并对其进行操作。

Hope it helps ! 希望能帮助到你 !

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

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