Connect specific volume of EBS to Docker under AWS beanstalk

AWS Beanstalk can run applications from Docker containers. As mentioned in the docs ( http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker_image.html ), you can write directory mappings in the EC2 volume to Dockerrun.aws.json:

"Volumes": [ { "HostDirectory": "/var/app/mydb", "ContainerDirectory": "/etc/mysql" } 

but is it possible to set a specific amount of EBS?

Fe I need to run db in a Docker container and deploy it using Beanstalk. It is clear that I need to have data persistence, backup / restore for db, etc.

+4
docker amazon-web-services amazon-ec2 elastic-beanstalk
source share
2 answers

You can mount EBS volumes in any Beanstalk environment. This volume will be available in EC2 instances.

You can do this using the ebextensions parameter settings. Create a file in the application source .ebextensions/01-ebs.config with the following contents:

 option_settings: - namespace: aws:autoscaling:launchconfiguration option_name: BlockDeviceMappings value: /dev/sdj=:100,/dev/sdh=snap-51eef269,/dev/sdb=ephemeral0 

The display format is the name of the device = where device mappings are listed as one line with mappings separated by commas. This example attaches to all instances in the autoscale group an empty 100 gigabyte Amazon EBS volume, an Amazon EBS volume with the snap-51eef269 label snapshot, and instance storage capacity.

Read more about this setting here . Read more about ebextensions here .

After you have installed the EBS volume for beanstalk instances, you can use volume mapping as described above to map directories to suit your needs.

+4
source share

I suggest that leg100 / docker-ebs-attach The Docker Console does what you want, i.e. Create an existing existing EBS volume. You can either copy the .py file and the corresponding Dockerfile instructions, or create a multi-container EB setting and install the volume from this container.

BTW I tried to install a new EBS volume proposed by Rohit (+ commands for formatting and mounting), and it works, but Docker does not see it until the docker daemon is restarted .

+1
source share

All Articles