Putting data into EBS backed EC2 instance

2019-07-11 23:46发布

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

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.

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 ?

1条回答
萌系小妹纸
2楼-- · 2019-07-12 00:31

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.

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.

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

查看更多
登录 后发表回答