Using your own EBS volume (created via AWS console or ElasticFox)
To start using an EBS volume with your application you need to do the following:
1. Initially you need to format your volume and copy your data file(s) on it
2. Run a script to mount this volume every time you start or re-start a deployment.
1. To format your volume you would need to SSH into a running EC2 instance (it has to be in the same availability zone as the volume) and do the following:
Then you need to mount the newly formatted volume:
$ ec2-attach-volume -d /dev/sdh -i <instance id> <volume id>
$ mkfs.xfs /dev/sdh
After that you can copy/move your data file(s) to a location under /mnt/ebs
$ mkdir /mnt/ebs
$ mount -t xfs /dev/sdh /mnt/ebs
2. To automatically mount the volume every time, you can have a script like the following:
You can then upload this script into the "App Server Startup Script" section of the "Create Deployment" screen in CloudFoundry.
if [ ! -a '/mnt/ebs' ]
ec2-attach-volume -d /dev/sdh -i `curl -s http://169.254.169.254/latest/meta-data/instance-id` <volume id>
mount -t xfs /dev/sdh /mnt/ebs
Using CloudFoundry storage options
It could be easier to use CloudFoundry storage options. Although you don't need a MySQL database, you can still take advantage of managing EBS volumes that comes with it.
When you create a deployment, select "New EBS Volume" in "Database Storage" drop-down under the "Database" section. Specify the volume size. CloudFoundry will automatically create an EBS Volume for you and take care of attaching it every time you deploy or re-deploy your application. The volume is mounted under /vol, and you could place your data file(s) there.
Depending on your selection of "Backup frequency" you data could be backed up automatically along with the empty MySQL database via EBS Snapshots.