在AWS豆茎摩具体EBS卷泊坞窗 [英] Mount specific EBS volume to Docker under AWS beanstalk

查看:261
本文介绍了在AWS豆茎摩具体EBS卷泊坞窗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

AWS魔豆可以运行泊坞容器的应用程序。 正如前面提到的文档(的http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker_image.html)它可以写在Dockerrun.aws.json的EC2卷目录映射:

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) it's possible to write directory mappings to the EC2 volume in the Dockerrun.aws.json:

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

但是,是否有可能安装特定的EBS卷?

but, is it possible to mount specific EBS volume?

F.e。我需要在泊坞容器中运行数据库和青苗部署。很显然,我需要有数据的持久性,备份/还原数据库等。

F.e. I need to run db in the Docker container and deploy it with Beanstalk. It's clear that I need to have persistence of the data, backup/restore for db, etc..

推荐答案

您可以安装在任何环境下魔豆EBS卷。该卷将可在EC2实例。

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

您可以使用ebextensions选项设置做到这一点。在你的应用程序源代码中创建一个文件 .ebextensions / 01-ebs.config 包含以下内容:

You can do this using ebextensions option settings. Create a file in your app 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

映射的格式是设备名称=卷,其中设备映射指定为与映射用逗号分隔的一个字符串。这个例子的重视,自动缩放组中的所有情况下,一个空的100 GB的亚马逊EBS卷,一个Amazon EBS卷的快照ID管理单元51eef269,和实例存储卷。

The format of the mapping is device name=volume where the device mappings are specified as a single string with mappings separated by a comma. This example attaches to all instances in the autoscaling group an empty 100-GB Amazon EBS volume, an Amazon EBS volume with the snapshot ID snap-51eef269, and an instance store volume.

了解更多关于此选项设置这里更多细节。 了解更多关于ebextensions <一href="http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html">here.

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

一旦你已经安装了EBS卷为您的魔豆的环境情况下,您可以使用卷映射,上面按您的需求目录映射。

Once you have mounted the EBS volume for your beanstalk environment instances, you can use the volume mapping as above to map directories per your need.

这篇关于在AWS豆茎摩具体EBS卷泊坞窗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆