如何在AWS EC2上增加根磁盘的大小以用于Elastic Beanstalk? [英] How can I just increase the size of my root disk on AWS EC2 for use with Elastic Beanstalk?

查看:232
本文介绍了如何在AWS EC2上增加根磁盘的大小以用于Elastic Beanstalk?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在部署时,我将数据文件从S3复制到我的根驱动器,以供Tomcat应用程序使用。这是完美的工作,麻烦的是根磁盘只有8GB,而我的数据文件很快就会更大。我想稍微增加根磁盘的大小(15GB应该可以再用一年),而不必使用更大,更昂贵的EC2实例,我目前正在使用m3.medium。

On deployment I copy datafiles from S3 to my root drive to be used by Tomcat application. This is working perfectly, the trouble is the root disk is only 8GB and my datafiles will soon be larger than that. I want to increase the size of the root disk a little (15GB should be fine for another year) without moving to a larger more expensive EC2 instance, I'm currently using m3.medium.

由于EB正在使用,我需要正确的EC2配置才能根据需要启动,我无法通过手动添加另一个磁盘来修改已经运行的实例。我正在使用EB负载平衡,因此实例可能会满足需求。

As being used by EB I need the correct EC2 configuration to start as required, I cannot modify an already running instance by manually adding another disk. I'm using EB load balanced so instances may come and go to meet demand.

推荐答案

这可以使用以下ebextension来完成

This can be done using the following ebextension snippet.

Resources:
    AWSEBAutoScalingLaunchConfiguration:
        Type: AWS::AutoScaling::LaunchConfiguration
        Properties:
            BlockDeviceMappings:
               - DeviceName: /dev/sda1
                 Ebs:
                     VolumeSize:
                        15

将此代码段添加到应用程序源中路径为 .ebextensions / 01-change-root-volume-size.config的文件中。您可以根据需要命名文件,但文件应位于 .ebextensions 目录中,后缀为 .config

Add this snippet to your app source in a file at path .ebextensions/01-change-root-volume-size.config. You can name the file whatever you want but it should be in the .ebextensions directory and should have a suffix of .config.

使用此新应用程序源更新您的环境。这将终止您当前的实例,并以您想要的大小启动一个新实例。

Update your environment with this new app source. This will terminate your current instance and start a new one with the size you desire.

了解有关使用Elastic Beanstalk自定义AWS资源的更多信息此处提供了有关可以对启动配置进行其他自定义的更多详细信息。 -launchconfig-blockdevicemappings>此处
有关ebextensions的更多文档,此处

Read more about customizing AWS Resources with Elastic Beanstalk here. More details on what other customizations you can do for the launchconfiguration are available here. More documentation on ebextensions here.

要记住的另一件事是,如果您使用的是c3.large,g2.2xlarge,i2.xlarge等HVM实例或GPU实例,则/ dev / sda1适用于m3.medium。那么您将需要使用DeviceName作为/ dev / xvda。

Another thing to remember is that /dev/sda1 works for m3.medium if you are using an HVM instance or GPU instance like c3.large, g2.2xlarge, i2.xlarge etc. then you will need to use DeviceName as /dev/xvda instead.

这篇关于如何在AWS EC2上增加根磁盘的大小以用于Elastic Beanstalk?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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