将数据放入EBS支持的EC2实例 [英] Putting data into EBS backed EC2 instance

查看:77
本文介绍了将数据放入EBS支持的EC2实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个AWS EC2实例,并为其附加了一个EBS卷.我已经在上面安装了LAMP堆栈和phpmyadmin.

I have created a AWS EC2 instance and attached a EBS volume to it. I have installed the LAMP stack and phpmyadmin on it.

我还可以使用Cyber​​duck(使用公私钥)初始化与其的SFTP连接,并将一些html/php文件上传到/var/www目录.

I am also able to initialize a SFTP connection to it using Cyberduck(using the public-private key) and uploaded some html/php files to the /var/www directory.

我希望在网页上添加一个上传表单,用户可以在其中将图像上传到他们的帐户.因此,我需要将这些图像存储到EBS卷中.我该怎么做呢?

I am looking to add a upload form to a web page where users can upload images to their account. So I will need to store these images into the EBS volume. How do I go about doing this ?

推荐答案

一旦附加了EBS卷,请对其进行格式化并将其安装在文件夹上. 要确认这一点,请ssh进入ec2实例并运行$ df -h,它显示已连接的卷.

Once you have attached the EBS volume, format it and mount it on a folder. To confirm this, ssh into the ec2 instance and run $ df -h , it shows the volume attached.

现在,当您上传图像时,您可以提供ebs vol的确切路径,因为它充当实例的外部硬盘驱动器.

Now when you upload the images, you can provide the exact path to the ebs vol as it works as an external hard drive to the instance.

另一种选择是,将代码移至ebs vol,假设路径为/home/ubuntu/vol,更改文件/etc/apache2/sites-enabled/default-ssl,然后将DocumentRoot替换为/home/ubuntu/vol

While another option is, move the code to the ebs vol, say the path is /home/ubuntu/vol , change the files /etc/apache2/sites-enabled/default-ssl and /etc/apache2/site-available/default replace DocumentRoot with /home/ubuntu/vol

这篇关于将数据放入EBS支持的EC2实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆