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 ?
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
replaceDocumentRoot
with/home/ubuntu/vol