Slide 39
Slide 39 text
© 2017 VASILY,Inc.
OpsWorksͱAutoScaling
AutoScalingLaunchConfiguration:
Type: 'AWS::AutoScaling::LaunchConfiguration'
Properties:
IamInstanceProfile: !Ref IAMInstanceProfile
ImageId: !Ref AMI
InstanceType: 'm4.large'
UserData:
Fn::Base64: !Sub
- |
#cloud-config
repo_update: true
repo_upgrade: security
packages:
- python-pip
runcmd:
- LC_ALL=C sudo pip install awscli
- export INSTANCE_ID=$(/usr/local/bin/aws opsworks --region us-east-1 register --infrastructure-class ec2 --stack-id
${OpsWorksStackId} --local --use-instance-profile 2>&1 | grep 'Instance ID' | grep -oE '[a-z0-9\-]+$')
- while ! /usr/local/bin/aws opsworks --region us-east-1 assign-instance --instance-id $INSTANCE_ID --layer-ids $
{OpsWorksLayerId}; do echo 'wait...'; sleep 20; done
- { OpsWorksStackId: !Ref OpsWorksStack, OpsWorksLayerId: !Ref OpsWorksLayer }
6TFS%BUB͔Β0QT8PSLTొ͢Δྫ