Question

I am very new to this and trying to do this the first time. I have learned that Amazon Elastic Block Storage(EBS) can be used in a similar way as a hard Disk when mounted on Amazon EC2. Now I wish to create a directory structure in EBS and save files from Java Servlet in EBS?

I have also learned that the code used by the servlet in development machine can be used to create a directory structure access files in EBS also

@MultipartConfig( location          = "d:\\tmp", 
                  fileSizeThreshold = 1024 * 1024, 
                  maxFileSize       = 1024 * 1024 * 5,
                  maxRequestSize    = 1024 * 1024 * 5 * 5  )

I have Amazon Linux installed on my Amazon EC2, any pointers will be great help?

Was it helpful?

Solution

EBS isn't similar to a hard disk, it behaves exactly as a hard disk from the perspective of your application (except that it's slower than a desktop hard disk unless you stripe multiple EBS volumes into a software RAID configuration).

After you have mounted your EBS volume, you use the EBS storage exactly as you would any other storage.

Instructions on how to mount the volume for Linux can be found here:

http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html

Following those steps, you would end up with a directory

/mnt/data-store

that corresponds to the EBS volume. If you don't like the name data-store you can change it to something else.

I did notice your example code refers to "d:\\tmp" which is a Windows path specification, but you state that your instance is running Linux. Be sure that you adjust any paths to point to /mnt/data-store.

OTHER TIPS

The easiest way to start using an EBS volume is to launch an EBS-backed EC2 instance. Those come pre-connected to an EBS volume (it is the boot volume).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top