在自动调节组内部inheritance了由负载平衡器,数据库服务器和多个Web服务器组成的基于Amazon的基础架构; 部署由CloudFormation协调。
问题是,旋转的web服务器有一个小的根卷(8GB),有时在Web服务器生命周期中,磁盘被日志和临时文件填满,一些服务停止工作。
我发现机器定义声明的部分(我认为):
... "Properties": { "ImageId": { "Fn::FindInMap": [ "AWSRegionArch2AMI", { "Ref": "AWS::Region" }, { "Fn::FindInMap": [ "AWSInstanceType2Arch", { "Ref": "InstanceType" }, "Arch" ] } ] }, "InstanceType": { "Ref": "InstanceType" }, "SecurityGroups": [ { "Ref": "WebServerSecurityGroup" } ], "KeyName": { "Ref": "KeyName" }, "UserData": { "Fn::Base64": { "Fn::Join": [ ...
实例types在其他地方被最终定义:
"InstanceType": { "Description": "WebServer EC2 instance type", "Type": "String", "Default": "c4.xlarge", "AllowedValues": [ "t1.micro", "t2.nano", # ... more allowed values "cg1.4xlarge" ], "ConstraintDescription": "must be a valid EC2 instance type." },
但是我不知道如何申报根卷的大小,也没有可能。 而且我也看不到任何一个ebs卷被宣布。
这是一台linux机器,根设备是/ dev / xvda1
[ec2-user@ip- /]$ df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 7.8G 1.6G 6.2G 21% / devtmpfs 3.7G 60K 3.7G 1% /dev tmpfs 3.7G 0 3.7G 0% /dev/shm
尝试了@Jasonbuild议的解决scheme (虽然用xvda1replacesda1 ),但CloudFormation不会在做这些之后启动任何新机器。
我可以看到,我上传新的模板与这些变化后,机器的启动configuration相应地更新:
但是新机器不会自动旋转起来。 🙁
查看http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html ,特别是关于“块设备映射”的部分。 您将按照下面的步骤进行EBS设备定义,如下所示:
{ "DeleteOnTermination" : Boolean, "Encrypted" : Boolean, "Iops" : Number, "SnapshotId" : String, "VolumeSize" : String, "VolumeType" : String }
https://forums.aws.amazon.com/thread.jspa?threadID=127767也描述了这一点:
"MyEC2Instance" : { "Type" : "AWS::EC2::Instance", "Properties" : { ............ ..... .. "BlockDeviceMappings" : [ { "DeviceName" : "/dev/sda1", "Ebs" : { "VolumeSize" : "20" } } ], "UserData" : {"Fn::Base64" : {"Fn::Join" : ["", [ "#!/bin/bash\n", "/sbin/resize2fs /dev/sda1\n" ]]}}, } }
或者,您可以重buildAMI以使其具有更大的尺寸。
另外,如果您的实例已经在运行,您可以按照本指南中的Awsbuild议的步骤操作: http : //docs.aws.amazon.com/AWSEC2/latest/UserGuide/storage_expand_partition.html
该指南是关于调整正在运行的实例的根分区的大小。