heat_template_version: 2013-05-23 description: AutoScaling Simple parameters: image: type: string description: Image used for servers default: ubuntu-14.04 flavor: type: string description: flavor used by the web servers default: m1.small public_net_id: type: string description: network on which the instances default: private key_name: type: string description: Name of an existing key pair to use for the template default: demo resources: auto_scale_group: type: OS::Heat::AutoScalingGroup properties: min_size: 1 max_size: 3 resource: type: OS::Nova::Server properties: name: test_server flavor: {get_param: flavor} image: {get_param: image} key_name: {get_param: key_name} metadata: {"metering.stack": {get_param: "OS::stack_id"}} networks: - network: { get_param: public_net_id } server_scaleup_policy: type: OS::Heat::ScalingPolicy properties: adjustment_type: change_in_capacity auto_scaling_group_id: {get_resource: auto_scale_group} cooldown: 60 scaling_adjustment: 1 server_scaledown_policy: type: OS::Heat::ScalingPolicy properties: adjustment_type: change_in_capacity auto_scaling_group_id: {get_resource: auto_scale_group} cooldown: 60 scaling_adjustment: -1 cpu_alarm_high: type: OS::Ceilometer::Alarm properties: description: Scale-up if the average CPU > 50% for 1 minute meter_name: cpu_util statistic: avg period: 60 evaluation_periods: 1 threshold: 50 alarm_actions: - {get_attr: [server_scaleup_policy, alarm_url]} matching_metadata: {'metadata.user_metadata.stack': {get_param: "OS::stack_id"}} comparison_operator: gt cpu_alarm_low: type: OS::Ceilometer::Alarm properties: description: Scale-down if the average CPU < 15% for 1 minute meter_name: cpu_util statistic: avg period: 60 evaluation_periods: 1 threshold: 15 alarm_actions: - {get_attr: [server_scaledown_policy, alarm_url]} matching_metadata: {'metadata.user_metadata.stack': {get_param: "OS::stack_id"}} comparison_operator: lt outputs: scale_up_url: description: > This URL is the webhook to scale up the group. You can invoke the scale-up operation by doing an HTTP POST to this URL; no body nor extra headers are needed. value: {get_attr: [server_scaleup_policy, alarm_url]} scale_dn_url: description: > This URL is the webhook to scale down the group. You can invoke the scale-down operation by doing an HTTP POST to this URL; no body nor extra headers are needed. value: {get_attr: [server_scaledown_policy, alarm_url]}