我目前正在研究CloudFormation项目,以构建容错架构。快照出现问题。我试图使用EBS快照来存储数据,因此当一个实例关闭时,另一实例可以通过自动缩放从快照加载数据。任何人都可以提出一些想法吗?
SnapshotId是由我们自己编写的,为什么在创建堆栈后在控制台中看不到它?
LaunchConfig:
Type: AWS::AutoScaling::LaunchConfiguration
Properties:
ImageId: ami-33f92051
InstanceType: t2.micro
AssociatePublicIpAddress: 'true' #auto-assign public ip
KeyName:
Ref: KeyName
SecurityGroups:
- Ref: PublicEC2instancesSecurityGroupJing
BlockDeviceMappings:
- DeviceName: "/dev/xvda"
Ebs:
SnapshotId: snap-0821cc7c34fcb7b01
VolumeSize: 8
UserData:
Fn::Base64:
Fn::Join:
- "\n"
- - "#!/bin/bash -xe"
- sudo yum update -y
- sudo yum install httpd24 php56 php56-mysqlnd -y
- sudo yum install mysql -y
- sudo service httpd start
- echo "<html><body><h1>Testing page !!!</h1>" >> /var/www/html/index.html
- echo "</body></html>" >> /var/www/html/index.html
答案 0 :(得分:0)
尝试将EFS用作中间存储并将其安装到每个实例。此外,您可以将S3存储桶用于此类数据。 S3也可以作为文件系统安装到实例。
<div class="list-group" id="sidebar">
<a href="#menu1" class="list-group-item" data-toggle="collapse">Item 1 <i class="fa fa-caret-down"></i></a>
<div class="collapse" id="menu1" data-parent="#sidebar">
<a href="#menu1sub1" class="list-group-item" data-toggle="collapse">Subitem 1 <i class="fa fa-caret-down"></i></a>
<div class="collapse" id="menu1sub1" data-parent="#menu1sub1">
<a href="#" class="list-group-item">Subitem 1 a</a>
<a href="#" class="list-group-item">Subitem 2 b</a>
<a href="#menu1sub1sub1" class="list-group-item" data-toggle="collapse">Subitem 3 c <i class="fa fa-caret-down"></i></a>
<div class="collapse" id="menu1sub1sub1">
<a href="#" class="list-group-item">Subitem 3 c - item 1</a>
<a href="#" class="list-group-item">Subitem 3 c - item 2</a>
</div>
<a href="#" class="list-group-item" data-parent="#menu1sub1">Subitem 4 d</a>
<a href="#menu1sub1sub2" class="list-group-item" data-toggle="collapse">Subitem 5 e <i class="fa fa-caret-down"></i></a>
<div class="collapse" id="menu1sub1sub2" data-parent="#menu1sub1sub2">
<a href="#" class="list-group-item">Subitem 5 e.1</a>
<a href="#" class="list-group-item">Subitem 5 e.2</a>
</div>
</div>
<a href="#" class="list-group-item" data-parent="#menu1">Subitem 2</a>
<a href="#" class="list-group-item" data-parent="#menu1">Subitem 3</a>
</div>
<a href="#" class="list-group-item" data-parent="#sidebar">Item 2</a>
<a href="#menu3" class="list-group-item" data-toggle="collapse">Item 3 <i class="fa fa-caret-down"></i></a>
<div class="collapse" id="menu3" data-parent="#sidebar">
<a href="#" class="list-group-item">3.1</a>
<a href="#menu3sub2" class="list-group-item" data-toggle="collapse">3.2 <i class="fa fa-caret-down"></i></a>
<div class="collapse" id="menu3sub2" data-parent="#menu3">
<a href="#" class="list-group-item">3.2 a</a>
<a href="#" class="list-group-item">3.2 b</a>
<a href="#" class="list-group-item">3.2 c</a>
</div>
<a href="#" class="list-group-item" data-parent="#menu3">3.3</a>
</div>
<a href="#" class="list-group-item" data-parent="#sidebar">Item 4</a>
<a href="#" class="list-group-item" data-parent="#sidebar">Item 5</a>
</div>
amazon-efs-utils
sudo yum install automake fuse fuse-devel gcc-c++ git libcurl-devel libxml2-devel make openssl-devel
安装必需的工具后,尝试安装存储桶
git clone https://github.com/s3fs-fuse/s3fs-fuse.git
cd s3fs-fuse
./autogen.sh
./configure --prefix=/usr --with-openssl
make
sudo make install
将此过程添加到您的用户数据中,并将在每次启动新实例或创建自定义AMI后完成。