Commit b074558f by e0d

Merge pull request #741 from edx/e0d/commoncluster

E0d/commoncluster
parents b82b0b54 308ad156
...@@ -62,29 +62,6 @@ ...@@ -62,29 +62,6 @@
], ],
"ConstraintDescription":"must be a valid EC2 instance type." "ConstraintDescription":"must be a valid EC2 instance type."
}, },
"ElasticsearchInstanceType":{
"Description":"Worker EC2 instance type",
"Type":"String",
"Default":"m1.small",
"AllowedValues":[
"t1.micro",
"m1.small",
"m1.medium",
"m1.large",
"m1.xlarge",
"m2.xlarge",
"m2.2xlarge",
"m2.4xlarge",
"m3.xlarge",
"m3.2xlarge",
"c1.medium",
"c1.xlarge",
"cc1.4xlarge",
"cc2.8xlarge",
"cg1.4xlarge"
],
"ConstraintDescription":"must be a valid EC2 instance type."
},
"ForumInstanceType":{ "ForumInstanceType":{
"Description":"Worker EC2 instance type", "Description":"Worker EC2 instance type",
"Type":"String", "Type":"String",
...@@ -131,8 +108,8 @@ ...@@ -131,8 +108,8 @@
], ],
"ConstraintDescription":"must be a valid EC2 instance type." "ConstraintDescription":"must be a valid EC2 instance type."
}, },
"RabbitInstanceType":{ "CommonClusterInstanceType":{
"Description":"RabbitMQ server EC2 instance type", "Description":"The instance type on which common, clustered applications, e.g., RabbitMQ and Elasticsearch are hosted.",
"Type":"String", "Type":"String",
"Default":"m1.small", "Default":"m1.small",
"AllowedValues":[ "AllowedValues":[
...@@ -155,7 +132,7 @@ ...@@ -155,7 +132,7 @@
"ConstraintDescription":"must be a valid EC2 instance type." "ConstraintDescription":"must be a valid EC2 instance type."
}, },
"XserverInstanceType":{ "XserverInstanceType":{
"Description":"RabbitMQ server EC2 instance type", "Description":"Xserver server EC2 instance type",
"Type":"String", "Type":"String",
"Default":"m1.small", "Default":"m1.small",
"AllowedValues":[ "AllowedValues":[
...@@ -178,7 +155,7 @@ ...@@ -178,7 +155,7 @@
"ConstraintDescription":"must be a valid EC2 instance type." "ConstraintDescription":"must be a valid EC2 instance type."
}, },
"XqueueInstanceType":{ "XqueueInstanceType":{
"Description":"RabbitMQ server EC2 instance type", "Description":"Xqueue server EC2 instance type",
"Type":"String", "Type":"String",
"Default":"m1.small", "Default":"m1.small",
"AllowedValues":[ "AllowedValues":[
...@@ -300,21 +277,16 @@ ...@@ -300,21 +277,16 @@
"Type":"Number", "Type":"Number",
"Default":"2" "Default":"2"
}, },
"RabbitMQDesiredCapacity":{ "CommonClusterDesiredCapacity":{
"Description":"The Auto-scaling group desired capacity for the RabbitMQ hosts", "Description":"The Auto-scaling group desired capacity for the CommonCluster hosts",
"Type":"Number", "Type":"Number",
"Default":"2" "Default":"3"
}, },
"WorkerDesiredCapacity":{ "WorkerDesiredCapacity":{
"Description":"The Auto-scaling group desired capacity for the celery worker hosts", "Description":"The Auto-scaling group desired capacity for the celery worker hosts",
"Type":"Number", "Type":"Number",
"Default":"2" "Default":"2"
}, },
"ElasticsearchDesiredCapacity":{
"Description":"The Auto-scaling group desired capacity for the forums hosts",
"Type":"Number",
"Default":"2"
},
"ForumDesiredCapacity":{ "ForumDesiredCapacity":{
"Description":"The Auto-scaling group desired capacity for the forums hosts", "Description":"The Auto-scaling group desired capacity for the forums hosts",
"Type":"Number", "Type":"Number",
...@@ -465,8 +437,9 @@ ...@@ -465,8 +437,9 @@
"XServerJail02": { "CIDR":"10.0.21.0/24" }, "XServerJail02": { "CIDR":"10.0.21.0/24" },
"Xqueue01": { "CIDR":"10.0.30.0/24" }, "Xqueue01": { "CIDR":"10.0.30.0/24" },
"Xqueue02": { "CIDR":"10.0.31.0/24" }, "Xqueue02": { "CIDR":"10.0.31.0/24" },
"Rabbit01": { "CIDR":"10.0.40.0/24" }, "CommonCluster01": { "CIDR":"10.0.46.0/24"},
"Rabbit02": { "CIDR":"10.0.41.0/24" }, "CommonCluster02": { "CIDR":"10.0.47.0/24"},
"CommonCluster03": { "CIDR":"10.0.48.0/24"},
"Data01": { "CIDR":"10.0.50.0/24" }, "Data01": { "CIDR":"10.0.50.0/24" },
"Data02": { "CIDR":"10.0.51.0/24" }, "Data02": { "CIDR":"10.0.51.0/24" },
"Cache01": { "CIDR":"10.0.60.0/24" }, "Cache01": { "CIDR":"10.0.60.0/24" },
...@@ -478,8 +451,6 @@ ...@@ -478,8 +451,6 @@
"Mongo01": { "CIDR":"10.0.90.0/24" }, "Mongo01": { "CIDR":"10.0.90.0/24" },
"Mongo02": { "CIDR":"10.0.91.0/24" }, "Mongo02": { "CIDR":"10.0.91.0/24" },
"Mongo03": { "CIDR":"10.0.92.0/24" }, "Mongo03": { "CIDR":"10.0.92.0/24" },
"Elasticsearch01": { "CIDR":"10.0.100.0/24" },
"Elasticsearch02": { "CIDR":"10.0.101.0/24" },
"Admin": { "CIDR":"10.0.200.0/24" } "Admin": { "CIDR":"10.0.200.0/24" }
}, },
"MapRegionsToAvailZones":{ "MapRegionsToAvailZones":{
...@@ -789,7 +760,7 @@ ...@@ -789,7 +760,7 @@
] ]
} }
}, },
"RabbitSubnet01":{ "CommonClusterSubnet01":{
"Type":"AWS::EC2::Subnet", "Type":"AWS::EC2::Subnet",
"Properties":{ "Properties":{
"VpcId":{ "VpcId":{
...@@ -798,7 +769,7 @@ ...@@ -798,7 +769,7 @@
"CidrBlock":{ "CidrBlock":{
"Fn::FindInMap":[ "Fn::FindInMap":[
"SubnetConfig", "SubnetConfig",
"Rabbit01", "CommonCluster01",
"CIDR" "CIDR"
] ]
}, },
...@@ -812,7 +783,7 @@ ...@@ -812,7 +783,7 @@
"Tags":[ "Tags":[
{ {
"Key":"play", "Key":"play",
"Value":"rabbitmq" "Value":"commoncluster"
}, },
{ {
"Key":"Network", "Key":"Network",
...@@ -826,7 +797,7 @@ ...@@ -826,7 +797,7 @@
"-", "-",
{"Ref":"DeploymentTag"}, {"Ref":"DeploymentTag"},
"-", "-",
"internal-rabbit','target':'ec2'}" "internal-commoncluster','target':'ec2'}"
] ]
] ]
} }
...@@ -834,7 +805,7 @@ ...@@ -834,7 +805,7 @@
] ]
} }
}, },
"RabbitSubnet02":{ "CommonClusterSubnet02":{
"Type":"AWS::EC2::Subnet", "Type":"AWS::EC2::Subnet",
"Properties":{ "Properties":{
"VpcId":{ "VpcId":{
...@@ -843,7 +814,7 @@ ...@@ -843,7 +814,7 @@
"CidrBlock":{ "CidrBlock":{
"Fn::FindInMap":[ "Fn::FindInMap":[
"SubnetConfig", "SubnetConfig",
"Rabbit02", "CommonCluster02",
"CIDR" "CIDR"
] ]
}, },
...@@ -857,7 +828,52 @@ ...@@ -857,7 +828,52 @@
"Tags":[ "Tags":[
{ {
"Key":"play", "Key":"play",
"Value":"rabbitmq" "Value":"commoncluster"
},
{
"Key":"Network",
"Value":"Private"
},
{
"Key" : "immutable_metadata",
"Value":{"Fn::Join":["",
["{'purpose':'",
{"Ref":"EnvironmentTag"},
"-",
{"Ref":"DeploymentTag"},
"-",
"internal-commoncluster','target':'ec2'}"
]
]
}
}
]
}
},
"CommonClusterSubnet03":{
"Type":"AWS::EC2::Subnet",
"Properties":{
"VpcId":{
"Ref":"EdxVPC"
},
"CidrBlock":{
"Fn::FindInMap":[
"SubnetConfig",
"CommonCluster03",
"CIDR"
]
},
"AvailabilityZone":{
"Fn::FindInMap":[
"MapRegionsToAvailZones",
{ "Ref":"AWS::Region" },
"AZone2"
]
},
"Tags":[
{
"Key":"play",
"Value":"commoncluster"
}, },
{ {
"Key":"Network", "Key":"Network",
...@@ -871,7 +887,7 @@ ...@@ -871,7 +887,7 @@
"-", "-",
{"Ref":"DeploymentTag"}, {"Ref":"DeploymentTag"},
"-", "-",
"internal-rabbit','target':'ec2'}" "internal-commoncluster','target':'ec2'}"
] ]
] ]
} }
...@@ -1187,96 +1203,6 @@ ...@@ -1187,96 +1203,6 @@
] ]
} }
}, },
"ElasticsearchSubnet01":{
"Type":"AWS::EC2::Subnet",
"Properties":{
"VpcId":{
"Ref":"EdxVPC"
},
"CidrBlock":{
"Fn::FindInMap":[
"SubnetConfig",
"Elasticsearch01",
"CIDR"
]
},
"AvailabilityZone":{
"Fn::FindInMap":[
"MapRegionsToAvailZones",
{ "Ref":"AWS::Region" },
"AZone0"
]
},
"Tags":[
{
"Key":"Application",
"Value":"elasticsearch"
},
{
"Key":"Network",
"Value":"Private"
},
{
"Key" : "immutable_metadata",
"Value":{"Fn::Join":["",
["{'purpose':'",
{"Ref":"EnvironmentTag"},
"-",
{"Ref":"DeploymentTag"},
"-",
"internal-elasticsearch','target':'ec2'}"
]
]
}
}
]
}
},
"ElasticsearchSubnet02":{
"Type":"AWS::EC2::Subnet",
"Properties":{
"VpcId":{
"Ref":"EdxVPC"
},
"CidrBlock":{
"Fn::FindInMap":[
"SubnetConfig",
"Elasticsearch02",
"CIDR"
]
},
"AvailabilityZone":{
"Fn::FindInMap":[
"MapRegionsToAvailZones",
{ "Ref":"AWS::Region" },
"AZone1"
]
},
"Tags":[
{
"Key":"Application",
"Value":"elasticsearch"
},
{
"Key":"Network",
"Value":"Private"
},
{
"Key" : "immutable_metadata",
"Value":{"Fn::Join":["",
["{'purpose':'",
{"Ref":"EnvironmentTag"},
"-",
{"Ref":"DeploymentTag"},
"-",
"internal-elasticsearch','target':'ec2'}"
]
]
}
}
]
}
},
"ForumSubnet01":{ "ForumSubnet01":{
"Type":"AWS::EC2::Subnet", "Type":"AWS::EC2::Subnet",
"Properties":{ "Properties":{
...@@ -1868,22 +1794,33 @@ ...@@ -1868,22 +1794,33 @@
} }
} }
}, },
"PrivateSubnetRouteTableAssociationRabbit01":{ "PrivateSubnetRouteTableAssociationCommonCluster01":{
"Type":"AWS::EC2::SubnetRouteTableAssociation",
"Properties":{
"SubnetId":{
"Ref":"CommonClusterSubnet01"
},
"RouteTableId":{
"Ref":"PrivateRouteTable"
}
}
},
"PrivateSubnetRouteTableAssociationCommonCluster02":{
"Type":"AWS::EC2::SubnetRouteTableAssociation", "Type":"AWS::EC2::SubnetRouteTableAssociation",
"Properties":{ "Properties":{
"SubnetId":{ "SubnetId":{
"Ref":"RabbitSubnet01" "Ref":"CommonClusterSubnet02"
}, },
"RouteTableId":{ "RouteTableId":{
"Ref":"PrivateRouteTable" "Ref":"PrivateRouteTable"
} }
} }
}, },
"PrivateSubnetRouteTableAssociationRabbit02":{ "PrivateSubnetRouteTableAssociationCommonCluster03":{
"Type":"AWS::EC2::SubnetRouteTableAssociation", "Type":"AWS::EC2::SubnetRouteTableAssociation",
"Properties":{ "Properties":{
"SubnetId":{ "SubnetId":{
"Ref":"RabbitSubnet02" "Ref":"CommonClusterSubnet03"
}, },
"RouteTableId":{ "RouteTableId":{
"Ref":"PrivateRouteTable" "Ref":"PrivateRouteTable"
...@@ -1978,28 +1915,6 @@ ...@@ -1978,28 +1915,6 @@
} }
} }
}, },
"PrivateSubnetRouteTableAssociationElasticsearch01":{
"Type":"AWS::EC2::SubnetRouteTableAssociation",
"Properties":{
"SubnetId":{
"Ref":"ElasticsearchSubnet01"
},
"RouteTableId":{
"Ref":"PrivateRouteTable"
}
}
},
"PrivateSubnetRouteTableAssociationElasticsearch02":{
"Type":"AWS::EC2::SubnetRouteTableAssociation",
"Properties":{
"SubnetId":{
"Ref":"ElasticsearchSubnet02"
},
"RouteTableId":{
"Ref":"PrivateRouteTable"
}
}
},
"PrivateSubnetRouteTableAssociationForum01":{ "PrivateSubnetRouteTableAssociationForum01":{
"Type":"AWS::EC2::SubnetRouteTableAssociation", "Type":"AWS::EC2::SubnetRouteTableAssociation",
"Properties":{ "Properties":{
...@@ -2164,22 +2079,33 @@ ...@@ -2164,22 +2079,33 @@
} }
} }
}, },
"PrivateSubnetNetworkAclAssociationRabbit01":{ "PrivateSubnetNetworkAclAssociationCommonCluster01":{
"Type":"AWS::EC2::SubnetNetworkAclAssociation",
"Properties":{
"SubnetId":{
"Ref":"CommonClusterSubnet01"
},
"NetworkAclId":{
"Ref":"PrivateNetworkAcl"
}
}
},
"PrivateSubnetNetworkAclAssociationCommonCluster02":{
"Type":"AWS::EC2::SubnetNetworkAclAssociation", "Type":"AWS::EC2::SubnetNetworkAclAssociation",
"Properties":{ "Properties":{
"SubnetId":{ "SubnetId":{
"Ref":"RabbitSubnet01" "Ref":"CommonClusterSubnet02"
}, },
"NetworkAclId":{ "NetworkAclId":{
"Ref":"PrivateNetworkAcl" "Ref":"PrivateNetworkAcl"
} }
} }
}, },
"PrivateSubnetNetworkAclAssociationRabbit02":{ "PrivateSubnetNetworkAclAssociationCommonCluster03":{
"Type":"AWS::EC2::SubnetNetworkAclAssociation", "Type":"AWS::EC2::SubnetNetworkAclAssociation",
"Properties":{ "Properties":{
"SubnetId":{ "SubnetId":{
"Ref":"RabbitSubnet02" "Ref":"CommonClusterSubnet03"
}, },
"NetworkAclId":{ "NetworkAclId":{
"Ref":"PrivateNetworkAcl" "Ref":"PrivateNetworkAcl"
...@@ -2274,28 +2200,6 @@ ...@@ -2274,28 +2200,6 @@
} }
} }
}, },
"PrivateSubnetNetworkAclAssociationElasticsearch01":{
"Type":"AWS::EC2::SubnetNetworkAclAssociation",
"Properties":{
"SubnetId":{
"Ref":"ElasticsearchSubnet01"
},
"NetworkAclId":{
"Ref":"PrivateNetworkAcl"
}
}
},
"PrivateSubnetNetworkAclAssociationElasticsearch02":{
"Type":"AWS::EC2::SubnetNetworkAclAssociation",
"Properties":{
"SubnetId":{
"Ref":"ElasticsearchSubnet02"
},
"NetworkAclId":{
"Ref":"PrivateNetworkAcl"
}
}
},
"PrivateSubnetNetworkAclAssociationForum01":{ "PrivateSubnetNetworkAclAssociationForum01":{
"Type":"AWS::EC2::SubnetNetworkAclAssociation", "Type":"AWS::EC2::SubnetNetworkAclAssociation",
"Properties":{ "Properties":{
...@@ -3649,12 +3553,15 @@ ...@@ -3649,12 +3553,15 @@
"Timeout":"1200" "Timeout":"1200"
} }
}, },
"RabbitMQServer":{ "CommonClusterServer":{
"Type":"AWS::AutoScaling::LaunchConfiguration", "Type":"AWS::AutoScaling::LaunchConfiguration",
"Properties":{ "Properties":{
"SecurityGroups":[ "SecurityGroups":[
{ {
"Ref":"RabbitMQServerSecurityGroup" "Ref":"RabbitMQServerSecurityGroup"
},
{
"Ref":"ElasticsearchServerSecurityGroup"
} }
], ],
"ImageId":{ "ImageId":{
...@@ -3667,7 +3574,7 @@ ...@@ -3667,7 +3574,7 @@
"Fn::FindInMap":[ "Fn::FindInMap":[
"AWSInstanceType2Arch", "AWSInstanceType2Arch",
{ {
"Ref":"RabbitInstanceType" "Ref":"CommonClusterInstanceType"
}, },
"Arch" "Arch"
] ]
...@@ -3686,7 +3593,7 @@ ...@@ -3686,7 +3593,7 @@
"{\n", "{\n",
" cfn-signal -e 1 -r \"$1\" '", " cfn-signal -e 1 -r \"$1\" '",
{ {
"Ref":"RabbitMQServerWaitHandle" "Ref":"CommonClusterServerWaitHandle"
}, },
"'\n", "'\n",
" exit 1\n", " exit 1\n",
...@@ -3699,7 +3606,7 @@ ...@@ -3699,7 +3606,7 @@
"# If all went well, signal success\n", "# If all went well, signal success\n",
"cfn-signal -e $? -r 'Edx Server configuration' '", "cfn-signal -e $? -r 'Edx Server configuration' '",
{ {
"Ref":"RabbitMQServerWaitHandle" "Ref":"CommonClusterServerWaitHandle"
}, },
"'\n" "'\n"
] ]
...@@ -3710,7 +3617,7 @@ ...@@ -3710,7 +3617,7 @@
"Ref":"KeyName" "Ref":"KeyName"
}, },
"InstanceType":{ "InstanceType":{
"Ref":"RabbitInstanceType" "Ref":"CommonClusterInstanceType"
}, },
"BlockDeviceMappings":[ "BlockDeviceMappings":[
{ {
...@@ -3728,35 +3635,44 @@ ...@@ -3728,35 +3635,44 @@
] ]
} }
}, },
"RabbitMQServerASGroup":{ "CommonClusterServerASGroup":{
"Type":"AWS::AutoScaling::AutoScalingGroup", "Type":"AWS::AutoScaling::AutoScalingGroup",
"Properties":{ "Properties":{
"AvailabilityZones":[ "AvailabilityZones":[
{ {
"Fn::GetAtt":[ "Fn::GetAtt":[
"RabbitSubnet01", "CommonClusterSubnet01",
"AvailabilityZone"
]
},
{
"Fn::GetAtt":[
"CommonClusterSubnet02",
"AvailabilityZone" "AvailabilityZone"
] ]
}, },
{ {
"Fn::GetAtt":[ "Fn::GetAtt":[
"RabbitSubnet02", "CommonClusterSubnet03",
"AvailabilityZone" "AvailabilityZone"
] ]
} }
], ],
"VPCZoneIdentifier":[ "VPCZoneIdentifier":[
{ {
"Ref":"RabbitSubnet01" "Ref":"CommonClusterSubnet01"
},
{
"Ref":"CommonClusterSubnet02"
}, },
{ {
"Ref":"RabbitSubnet02" "Ref":"CommonClusterSubnet03"
} }
], ],
"Tags":[ "Tags":[
{ {
"Key":"play", "Key":"play",
"Value":"rabbitmq", "Value":"commoncluster",
"PropagateAtLaunch":true "PropagateAtLaunch":true
}, },
{ {
...@@ -3775,121 +3691,94 @@ ...@@ -3775,121 +3691,94 @@
} }
], ],
"LaunchConfigurationName":{ "LaunchConfigurationName":{
"Ref":"RabbitMQServer" "Ref":"CommonClusterServer"
}, },
"MinSize":{ "MinSize":{
"Ref":"RabbitMQDesiredCapacity" "Ref":"CommonClusterDesiredCapacity"
}, },
"MaxSize":{ "MaxSize":{
"Ref":"RabbitMQDesiredCapacity" "Ref":"CommonClusterDesiredCapacity"
}, },
"DesiredCapacity":{ "DesiredCapacity":{
"Ref":"RabbitMQDesiredCapacity" "Ref":"CommonClusterDesiredCapacity"
}, },
"LoadBalancerNames":[ "LoadBalancerNames":[
{ {
"Ref":"RabbitMQELB" "Ref":"RabbitMQELB"
},
{
"Ref":"ElasticSearchELB"
} }
] ]
} }
}, },
"RabbitMQScaleUpPolicy":{ "CommonClusterCPUAlarmHigh":{
"Type":"AWS::AutoScaling::ScalingPolicy",
"Properties":{
"AdjustmentType":"ChangeInCapacity",
"AutoScalingGroupName":{
"Ref":"RabbitMQServerASGroup"
},
"Cooldown":"60",
"ScalingAdjustment":"1"
}
},
"RabbitMQScaleDownPolicy":{
"Type":"AWS::AutoScaling::ScalingPolicy",
"Properties":{
"AdjustmentType":"ChangeInCapacity",
"AutoScalingGroupName":{
"Ref":"RabbitMQServerASGroup"
},
"Cooldown":"60",
"ScalingAdjustment":"-1"
}
},
"RabbitMQCPUAlarmHigh":{
"Type":"AWS::CloudWatch::Alarm", "Type":"AWS::CloudWatch::Alarm",
"Properties":{ "Properties":{
"AlarmDescription":"Scale-up if CPU > 90% for 10 minutes", "AlarmDescription":"Alarm if CPU > 90% for 10 minutes",
"MetricName":"CPUUtilization", "MetricName":"CPUUtilization",
"Namespace":"AWS/EC2", "Namespace":"AWS/EC2",
"Statistic":"Average", "Statistic":"Average",
"Period":"300", "Period":"300",
"EvaluationPeriods":"2", "EvaluationPeriods":"2",
"Threshold":"90", "Threshold":"90",
"AlarmActions":[ "AlarmActions":[],
{
"Ref":"RabbitMQScaleUpPolicy"
}
],
"Dimensions":[ "Dimensions":[
{ {
"Name":"AutoScalingGroupName", "Name":"AutoScalingGroupName",
"Value":{ "Value":{
"Ref":"RabbitMQServerASGroup" "Ref":"CommonClusterServerASGroup"
} }
} }
], ],
"ComparisonOperator":"GreaterThanThreshold" "ComparisonOperator":"GreaterThanThreshold"
} }
}, },
"RabbitMQCPUAlarmLow":{ "CommonClusterCPUAlarmLow":{
"Type":"AWS::CloudWatch::Alarm", "Type":"AWS::CloudWatch::Alarm",
"Properties":{ "Properties":{
"AlarmDescription":"Scale-down if CPU < 70% for 10 minutes", "AlarmDescription":"Alarm if CPU < 70% for 10 minutes",
"MetricName":"CPUUtilization", "MetricName":"CPUUtilization",
"Namespace":"AWS/EC2", "Namespace":"AWS/EC2",
"Statistic":"Average", "Statistic":"Average",
"Period":"300", "Period":"300",
"EvaluationPeriods":"2", "EvaluationPeriods":"2",
"Threshold":"70", "Threshold":"70",
"AlarmActions":[ "AlarmActions":[],
{
"Ref":"RabbitMQScaleDownPolicy"
}
],
"Dimensions":[ "Dimensions":[
{ {
"Name":"AutoScalingGroupName", "Name":"AutoScalingGroupName",
"Value":{ "Value":{
"Ref":"RabbitMQServerASGroup" "Ref":"CommonClusterServerASGroup"
} }
} }
], ],
"ComparisonOperator":"LessThanThreshold" "ComparisonOperator":"LessThanThreshold"
} }
}, },
"RabbitMQELB":{ "ElasticSearchELB":{
"Type":"AWS::ElasticLoadBalancing::LoadBalancer", "Type":"AWS::ElasticLoadBalancing::LoadBalancer",
"Properties":{ "Properties":{
"Scheme":"internal", "Scheme":"internal",
"SecurityGroups":[ "SecurityGroups":[
{ {
"Ref":"RabbitMQELBSecurityGroup" "Ref":"ElasticSearchELBSecurityGroup"
} }
], ],
"Listeners":[ "Listeners":[
{ {
"LoadBalancerPort":"5672", "LoadBalancerPort":"9200",
"InstancePort":"5672", "InstancePort":"9200",
"Protocol":"TCP" "Protocol":"TCP"
}, },
{ {
"LoadBalancerPort":"6163", "LoadBalancerPort":"9300",
"InstancePort":"6163", "InstancePort":"9300",
"Protocol":"TCP" "Protocol":"TCP"
} }
], ],
"HealthCheck":{ "HealthCheck":{
"Target":"TCP:5672", "Target":"TCP:9200",
"HealthyThreshold":"3", "HealthyThreshold":"3",
"UnhealthyThreshold":"5", "UnhealthyThreshold":"5",
"Interval":"30", "Interval":"30",
...@@ -3897,10 +3786,122 @@ ...@@ -3897,10 +3786,122 @@
}, },
"Subnets":[ "Subnets":[
{ {
"Ref":"RabbitSubnet01" "Ref":"CommonClusterSubnet01"
},
{
"Ref":"CommonClusterSubnet02"
}, },
{ {
"Ref":"RabbitSubnet02" "Ref":"CommonClusterSubnet03"
}
]
}
},
"ElasticSearchELBSecurityGroup":{
"Type":"AWS::EC2::SecurityGroup",
"Properties":{
"GroupDescription":"Enable TCP access on elasticsearch ports",
"VpcId":{
"Ref":"EdxVPC"
},
"SecurityGroupIngress":[
{
"IpProtocol":"tcp",
"FromPort":"9200",
"ToPort":"9200",
"CidrIp":"10.0.0.0/16"
},
{
"IpProtocol":"tcp",
"FromPort":"9300",
"ToPort":"9300",
"CidrIp":"10.0.0.0/16"
}
],
"SecurityGroupEgress":[
{
"IpProtocol":"tcp",
"FromPort":"9200",
"ToPort":"9200",
"CidrIp":"10.0.0.0/16"
},
{
"IpProtocol":"tcp",
"FromPort":"9300",
"ToPort":"9300",
"CidrIp":"10.0.0.0/16"
}
]
}
},
"ElasticsearchServerSecurityGroup":{
"Type":"AWS::EC2::SecurityGroup",
"Properties":{
"GroupDescription":"Open up SSH access plus Edx Server required ports",
"VpcId":{
"Ref":"EdxVPC"
},
"SecurityGroupIngress":[
{
"IpProtocol":"tcp",
"FromPort":"22",
"ToPort":"22",
"CidrIp":{
"Ref":"SSHLocation"
}
},
{
"IpProtocol":"tcp",
"FromPort": 9200,
"ToPort": 9200,
"CidrIp":"10.0.0.0/16"
},
{
"IpProtocol":"tcp",
"FromPort": 9300,
"ToPort": 9300,
"CidrIp":"10.0.0.0/16"
}
]
}
},
"RabbitMQELB":{
"Type":"AWS::ElasticLoadBalancing::LoadBalancer",
"Properties":{
"Scheme":"internal",
"SecurityGroups":[
{
"Ref":"RabbitMQELBSecurityGroup"
}
],
"Listeners":[
{
"LoadBalancerPort":"5672",
"InstancePort":"5672",
"Protocol":"TCP"
},
{
"LoadBalancerPort":"6163",
"InstancePort":"6163",
"Protocol":"TCP"
}
],
"HealthCheck":{
"Target":"TCP:5672",
"HealthyThreshold":"3",
"UnhealthyThreshold":"5",
"Interval":"30",
"Timeout":"5"
},
"Subnets":[
{
"Ref":"CommonClusterSubnet01"
},
{
"Ref":"CommonClusterSubnet02"
},
{
"Ref":"CommonClusterSubnet03"
} }
] ]
} }
...@@ -4023,15 +4024,15 @@ ...@@ -4023,15 +4024,15 @@
] ]
} }
}, },
"RabbitMQServerWaitHandle":{ "CommonClusterServerWaitHandle":{
"Type":"AWS::CloudFormation::WaitConditionHandle" "Type":"AWS::CloudFormation::WaitConditionHandle"
}, },
"RabbitMQServerWaitCondition":{ "CommonClusterServerWaitCondition":{
"Type":"AWS::CloudFormation::WaitCondition", "Type":"AWS::CloudFormation::WaitCondition",
"DependsOn":"RabbitMQServer", "DependsOn":"CommonClusterServer",
"Properties":{ "Properties":{
"Handle":{ "Handle":{
"Ref":"RabbitMQServerWaitHandle" "Ref":"CommonClusterServerWaitHandle"
}, },
"Timeout":"1200" "Timeout":"1200"
} }
...@@ -4781,267 +4782,6 @@ ...@@ -4781,267 +4782,6 @@
"Timeout":"1200" "Timeout":"1200"
} }
}, },
"ElasticsearchServer":{
"Type":"AWS::AutoScaling::LaunchConfiguration",
"Properties":{
"SecurityGroups":[
{
"Ref":"ElasticsearchServerSecurityGroup"
}
],
"ImageId":{
"Fn::FindInMap":[
"AWSRegionArch2AMI",
{
"Ref":"AWS::Region"
},
{
"Fn::FindInMap":[
"AWSInstanceType2Arch",
{
"Ref":"ElasticsearchInstanceType"
},
"Arch"
]
}
]
},
"UserData":{
"Fn::Base64":{
"Fn::Join":[
"",
[
"#!/bin/bash -x\n",
"exec >> /home/ubuntu/cflog.log\n",
"exec 2>> /home/ubuntu/cflog.log\n",
"function error_exit\n",
"{\n",
" cfn-signal -e 1 -r \"$1\" '",
{
"Ref":"ElasticsearchServerWaitHandle"
},
"'\n",
" exit 1\n",
"}\n",
"for dev in /dev/xvdc /dev/xvdd; do sudo echo w | fdisk $dev; sudo mkfs -t ext4 $dev;done;\n",
"sudo mkdir /mnt/logs\n",
"sudo mount /dev/xvdc /mnt/logs\n",
"sudo mount /dev/xvdd /opt\n",
"apt-get -y update\n",
"apt-get -y install python-setuptools\n",
"echo \"Python Tools installed\" - `date` >> /home/ubuntu/cflog.txt\n",
"easy_install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz\n",
"echo \"Cloudformation Boostrap installed \" - `date` >> /home/ubuntu/cflog.txt\n",
"# If all went well, signal success\n",
"cfn-signal -e $? -r 'Edx Server configuration' '",
{
"Ref":"ElasticsearchServerWaitHandle"
},
"'\n"
]
]
}
},
"KeyName":{
"Ref":"KeyName"
},
"InstanceType":{
"Ref":"ElasticsearchInstanceType"
},
"BlockDeviceMappings":[
{
"DeviceName":"/dev/xvdc",
"Ebs":{
"VolumeSize":"50"
}
},
{
"DeviceName":"/dev/xvdd",
"Ebs":{
"VolumeSize":"50"
}
}
]
}
},
"ElasticsearchServerASGroup":{
"Type":"AWS::AutoScaling::AutoScalingGroup",
"Properties":{
"AvailabilityZones":[
{
"Fn::GetAtt":[
"ElasticsearchSubnet01",
"AvailabilityZone"
]
},
{
"Fn::GetAtt":[
"ElasticsearchSubnet02",
"AvailabilityZone"
]
}
],
"VPCZoneIdentifier":[
{
"Ref":"ElasticsearchSubnet01"
},
{
"Ref":"ElasticsearchSubnet02"
}
],
"Tags":[
{
"Key":"play",
"Value":"elasticsearch",
"PropagateAtLaunch":true
},
{
"Key":"environment",
"Value":{
"Ref":"EnvironmentTag"
},
"PropagateAtLaunch":true
},
{
"Key":"deployment",
"Value":{
"Ref":"DeploymentTag"
},
"PropagateAtLaunch":true
}
],
"LaunchConfigurationName":{
"Ref":"ElasticsearchServer"
},
"MinSize":{
"Ref":"ElasticsearchDesiredCapacity"
},
"MaxSize":{
"Ref":"ElasticsearchDesiredCapacity"
},
"DesiredCapacity":{
"Ref":"ElasticsearchDesiredCapacity"
}
}
},
"ElasticsearchServerScaleUpPolicy":{
"Type":"AWS::AutoScaling::ScalingPolicy",
"Properties":{
"AdjustmentType":"ChangeInCapacity",
"AutoScalingGroupName":{
"Ref":"ElasticsearchServerASGroup"
},
"Cooldown":"60",
"ScalingAdjustment":"1"
}
},
"ElasticsearchServerScaleDownPolicy":{
"Type":"AWS::AutoScaling::ScalingPolicy",
"Properties":{
"AdjustmentType":"ChangeInCapacity",
"AutoScalingGroupName":{
"Ref":"ElasticsearchServerASGroup"
},
"Cooldown":"60",
"ScalingAdjustment":"-1"
}
},
"ElasticsearchCPUAlarmHigh":{
"Type":"AWS::CloudWatch::Alarm",
"Properties":{
"AlarmDescription":"Scale-up if CPU > 90% for 10 minutes",
"MetricName":"CPUUtilization",
"Namespace":"AWS/EC2",
"Statistic":"Average",
"Period":"300",
"EvaluationPeriods":"2",
"Threshold":"90",
"AlarmActions":[
{
"Ref":"ElasticsearchServerScaleUpPolicy"
}
],
"Dimensions":[
{
"Name":"AutoScalingGroupName",
"Value":{
"Ref":"ElasticsearchServerASGroup"
}
}
],
"ComparisonOperator":"GreaterThanThreshold"
}
},
"ElasticsearchCPUAlarmLow":{
"Type":"AWS::CloudWatch::Alarm",
"Properties":{
"AlarmDescription":"Scale-down if CPU < 70% for 10 minutes",
"MetricName":"CPUUtilization",
"Namespace":"AWS/EC2",
"Statistic":"Average",
"Period":"300",
"EvaluationPeriods":"2",
"Threshold":"70",
"AlarmActions":[
{
"Ref":"ElasticsearchServerScaleDownPolicy"
}
],
"Dimensions":[
{
"Name":"AutoScalingGroupName",
"Value":{
"Ref":"ElasticsearchServerASGroup"
}
}
],
"ComparisonOperator":"LessThanThreshold"
}
},
"ElasticsearchServerSecurityGroup":{
"Type":"AWS::EC2::SecurityGroup",
"Properties":{
"GroupDescription":"Open up SSH access plus Edx Server required ports",
"VpcId":{
"Ref":"EdxVPC"
},
"SecurityGroupIngress":[
{
"IpProtocol":"tcp",
"FromPort":"22",
"ToPort":"22",
"CidrIp":{
"Ref":"SSHLocation"
}
},
{
"IpProtocol":"tcp",
"FromPort": 9200,
"ToPort": 9200,
"CidrIp":"0.0.0.0/0"
},
{
"IpProtocol":"tcp",
"FromPort": 9300,
"ToPort": 9300,
"CidrIp":"0.0.0.0/0"
}
]
}
},
"ElasticsearchServerWaitHandle":{
"Type":"AWS::CloudFormation::WaitConditionHandle"
},
"ElasticsearchServerWaitCondition":{
"Type":"AWS::CloudFormation::WaitCondition",
"DependsOn":"ElasticsearchServer",
"Properties":{
"Handle":{
"Ref":"ElasticsearchServerWaitHandle"
},
"Timeout":"1200"
}
},
"ForumServer":{ "ForumServer":{
"Type":"AWS::AutoScaling::LaunchConfiguration", "Type":"AWS::AutoScaling::LaunchConfiguration",
"Properties":{ "Properties":{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment