简体   繁体   English

如何从Amazon EC2上的Web应用程序访问文件存储

[英]How to access file storage from web application on Amazon EC2

I am in process of hosting a dynamic website on Amazon EC2. 我正在在Amazon EC2上托管动态网站。 I have created the environment and deployed war on ElasticStalkBean. 我已经创建了环境,并在ElasticStalkBean上部署了战争。 I can connect to mysql database too. 我也可以连接到mysql数据库。 But I am not sure how my web application will read/write to the disk and at which path? 但是我不确定我的Web应用程序将如何在磁盘上读取/写入磁盘以及在哪条路径上写入? As per my understanding, Amazon provides 3 options for file storage S3 EBS (Persistant) instance storage 据我了解,Amazon提供了3种文件存储选项S3 EBS(持久性)实例存储

I could upload files on s3 creaing bucket but how can my web application read or write to S3 bucket path on differnt server? 我可以在s3提升存储桶中上传文件,但是我的Web应用程序如何在不同服务器上读取或写入S3存储桶路径?

I am not sure how should i upload files or write file to EBS. 我不确定如何上传文件或将文件写入EBS。 Connecting to EC2, I cannot cd /dev/sd* directory for my EBS attached to my environment instance. 连接到EC2时,无法将EBS的cd / dev / sd *目录连接到环境实例。 How can I configure my web app to use this as directory for images etc 如何配置我的Web应用程序以将其用作图像等的目录

Instance storage is lost if I stop or recreate env. 如果停止或重新创建环境,实例存储将丢失。 and is non persistant. 并且是非持久性的。 So not interested to store files here. 因此不希望在此处存储文件。

Can you help me on this? 你能帮我吗? Where to upload file that are read by application? 在哪里上传应用程序读取的文件? Where can my application write files? 我的应用程序可以在哪里写文件?

Your question: "how can my web application read or write to S3 bucket path on different server? 您的问题: “我的Web应用程序如何在不同服务器上读取或写入S3存储桶路径?

I'm a newbie user of AWS too, so can only offer limited help, but this is what I understand: The webapp running in the EC2 instance can access the S3 storage using with the REST or SOAP APIs. 我也是AWS的新手用户,因此只能提供有限的帮助,但这是我的理解:在EC2实例中运行的Webapp可以使用REST或SOAP API访问S3存储。 Here's the link to the reference guide for using the REST GET function to get a file from S3: 这是使用REST GET函数从S3获取文件的参考指南的链接:

GET object documentation GET对象文档

I guess the idea is that the S3 storage bucket that Amazon create for your EBS "environments" provides permanent storage for your application and data files (images etc.). 我想这是亚马逊为您的EBS“环境”创建的S3存储桶为您的应用程序和数据文件(图像等)提供永久存储。 When a EC2 instance is created or rebooted, it should get any additional application files from an S3 bucket and 'cache' them on the file system ("volume") attached to the EC2 "instance". 创建或重新引导EC2实例时,它应从S3存储桶中获取所有其他应用程序文件,并将它们“缓存”在与EC2“实例”相连的文件系统(“卷”)上。

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

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