diff options
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-heat/autoscaling_example.template')
| -rw-r--r-- | meta-openstack/recipes-devtools/python/python-heat/autoscaling_example.template | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-heat/autoscaling_example.template b/meta-openstack/recipes-devtools/python/python-heat/autoscaling_example.template new file mode 100644 index 0000000..6391187 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-heat/autoscaling_example.template | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | heat_template_version: 2014-05-06 | ||
| 2 | description: AutoScaling | ||
| 3 | parameters: | ||
| 4 | instance_type: | ||
| 5 | type: string | ||
| 6 | description: Type of the instance to be created. | ||
| 7 | default: m1.tiny | ||
| 8 | constraints: | ||
| 9 | - allowed_values: [m1.tiny, m1.small, m1.medium, m1.large] | ||
| 10 | description: | ||
| 11 | Value must be one of 'm1.tiny', 'm1.small', 'm1.medium' or 'm1.large'. | ||
| 12 | image_id: | ||
| 13 | type: string | ||
| 14 | description: ID of the image to use for the instance to be created. | ||
| 15 | default: myfirstimage | ||
| 16 | resources: | ||
| 17 | web_server_group_launch_conf: | ||
| 18 | type: AWS::AutoScaling::LaunchConfiguration | ||
| 19 | properties: | ||
| 20 | ImageId: { get_param: image_id } | ||
| 21 | InstanceType: { get_param: instance_type } | ||
| 22 | server_group: | ||
| 23 | type: AWS::AutoScaling::AutoScalingGroup | ||
| 24 | properties: | ||
| 25 | AvailabilityZones: ["RegionOne"] | ||
| 26 | MinSize: '1' | ||
| 27 | MaxSize: '3' | ||
| 28 | LaunchConfigurationName: {get_resource: web_server_group_launch_conf} | ||
| 29 | web_server_scaleup_policy: | ||
| 30 | type: AWS::AutoScaling::ScalingPolicy | ||
| 31 | properties: | ||
| 32 | AdjustmentType: ChangeInCapacity | ||
| 33 | AutoScalingGroupName: {get_resource: server_group} | ||
| 34 | Cooldown: 60 | ||
| 35 | ScalingAdjustment: 1 | ||
| 36 | web_server_scaledown_policy: | ||
| 37 | type: AWS::AutoScaling::ScalingPolicy | ||
| 38 | properties: | ||
| 39 | AdjustmentType: ChangeInCapacity | ||
| 40 | AutoScalingGroupName: {get_resource: server_group} | ||
| 41 | Cooldown: 60 | ||
| 42 | ScalingAdjustment: -1 | ||
| 43 | cpu_alarm_high: | ||
| 44 | type: OS::Ceilometer::Alarm | ||
| 45 | properties: | ||
| 46 | description: Scale-up if the average CPU > 80% for 5 minute | ||
| 47 | meter_name: cpu_util | ||
| 48 | statistic: avg | ||
| 49 | period: '300' | ||
| 50 | evaluation_periods: '1' | ||
| 51 | threshold: '80' | ||
| 52 | alarm_actions: | ||
| 53 | - {get_attr: [web_server_scaleup_policy, AlarmUrl]} | ||
| 54 | comparison_operator: gt | ||
| 55 | cpu_alarm_low: | ||
| 56 | type: OS::Ceilometer::Alarm | ||
| 57 | properties: | ||
| 58 | description: Scale-down if the average CPU < 45% for 2 minutes | ||
| 59 | meter_name: cpu_util | ||
| 60 | statistic: avg | ||
| 61 | period: '120' | ||
| 62 | evaluation_periods: '1' | ||
| 63 | threshold: '45' | ||
| 64 | alarm_actions: | ||
| 65 | - {get_attr: [web_server_scaledown_policy, AlarmUrl]} | ||
| 66 | comparison_operator: lt | ||
