{ "Parameters": { "MinFrontendsVar": {"Type": "Number", "MinValue": "0", "Default": "0"}, "MaxFrontendsVar": {"Type": "Number", "MinValue": "1", "Default": "1"} }, "Resources": { "Frontends": { "Type": "AWS::AutoScaling::AutoScalingGroup", "UpdatePolicy": { "AutoScalingRollingUpdate": { "MinInstancesInService": {"Ref": "MinFrontendsVar"}, "MaxBatchSize": "1", "PauseTime": "PT0S" } }, "Properties": { "AvailabilityZones": [ {"Fn::GetAtt": ["SubnetA", "AvailabilityZone"]}, {"Fn::GetAtt": ["SubnetB", "AvailabilityZone"]}, {"Fn::GetAtt": ["SubnetC", "AvailabilityZone"]} ], "VPCZoneIdentifier": [ {"Ref": "SubnetA"}, {"Ref": "SubnetB"}, {"Ref": "SubnetC"} ], "LaunchConfigurationName": {"Ref": "FrontendLaunchConfiguration"}, "MinSize": {"Ref": "MinFrontendsVar"}, "MaxSize": {"Ref": "MaxFrontendsVar"}, "DesiredCapacity": {"Ref": "MinFrontendsVar"}, "HealthCheckType": "ELB", "HealthCheckGracePeriod": "1600", "LoadBalancerNames": [ {"Ref": "ClientAPILoadBalancer"} ], "TerminationPolicies": ["OldestLaunchConfiguration", "OldestInstance"], "MetricsCollection": [{ "Granularity": "1Minute", "Metrics": ["GroupMinSize", "GroupMaxSize"] }] } }, "FrontendLaunchConfiguration" : { "Type" : "AWS::AutoScaling::LaunchConfiguration", "DependsOn": "InternetConnection", "Metadata": { "AWS::CloudFormation::Init": {} }, "Properties" : { "InstanceType": "m3.medium", "ImageId": {"Ref": "InstanceAMIVar"}, "KeyName": {"Ref": "IAMKeypairNameVar"}, "SecurityGroups": [{"Ref": "FrontendSecurityGroup"}], "AssociatePublicIpAddress": "true", "UserData": {"Fn::Base64": {"Fn::Join": ["", [ "#!/bin/bash\n", "export CFN_REGION='", {"Ref": "AWS::Region"}, "'\n", "export CFN_STACK_NAME='", {"Ref": "AWS::StackName"}, "'\n", "export CFN_INSTANCE_LOGICAL_NAME='FrontendLaunchConfiguration'\n", "export CFN_INSTANCE_HOSTNAME='", {"Fn::FindInMap": ["StackZoneRecords", "ClientAPI", "DNSName"]}, "'\n", "export BEXNG_ADMIN_API_HOST='", {"Fn::FindInMap": ["StackZoneRecords", "AdminAPI", "DNSName" ]}, "'\n", {"Ref": "UserDataEnvironmentVar"}, "\n", {"Ref": "CommonRoleScriptVar"}, "\n", {"Ref": "FrontendRoleScriptVar"}, "\n" ]]}} } } } }