• Home
  • VPS Servers
  • Dedicated Server Slices
  • Shared Web Hosting
  • About Us
  • Support
  • Contact
  • Blog
  • Client Login
  • VM Admin
VPS City
  • Home
  • VPS Servers
  • Dedicated Server Slices
  • Shared Web Hosting
  • About Us
  • Support
  • Contact
  • Blog
  • Client Login
  • VM Admin

Openstack HEAT tutorials: 2. Creating multiple resources of the same type using autoscaling group

May 29, 2015Gabriel MoldoveanuCloud Servers0 Comment

This example will show you how to create multiple resources of the same type using autoscaling groups.

The real power of autoscaling groups is to use them together with scale-up/down policies in order for Openstack to automatically create new instances (scale-up) or delete instances (scale-down) based on a chosen metric. For example, when the average CPU utilization grows above 50% it will create a new instance (identical to the others) and when  the average CPU utilization drops below 15% it will delete one or more instances in order to efficiently use the virtual resources. This complex example, will be detailed in the next tutorial (Tutorial 3).

The example below, uses the autoscaling group to create N identical resources, in this case 10 identical servers.

For details aboout the template section and the parameters section, please look at Tutorial 1

 

[code lang=”bash”] {
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Heat template for creating an instance with haproxy installed and configured for basic HTTP load balancing",
"Parameters": {
"Instance Image Id" : {
"Description" : "Image Id to be used when launching the instance",
"Type" : "String",
"Default" : "8e66f730-bbfe-4864-8e15-e5611f56cdb8"
},
"Instance Flavour" : {
"Description" : "Flavour to be used when launching the instance",
"Type" : "String",
"Default" : "m1.small"
},
"Network ID" : {
"Description" : "ID of Neutron network into which servers get deployed",
"Type" : "String",
"Default" : "d073e257-bbfb-41d9-af26-e78fea76b30f"
},
"KeyPair" : {
"Description" : "Keypair to be used when launching the instance",
"Type" : "String",
"Default" : "mbalas"
},
"SecurityGroup" : {
"Description" : "SecurityGroup to be used when launching the instance",
"Type" : "String",
"Default" : "MBA_securityGroup"
}
},
"Resources" : {
"ApacheServer" : {
"Type": "OS::Heat::AutoScalingGroup",
"Properties" : {
"desired_capacity": 10,
"max_size": 10,
"min_size": 10,
"resource": {
"type" : "OS::Nova::Server",
"properties" : {
"name" : "Apache",
"image" : {"Ref" : "Instance Image Id"},
"flavor": {"Ref" : "Instance Flavour"},
"networks": [{"network":{"Ref" : "Network ID"}}],
"key_name": {"Ref" : "KeyPair"},
"security_groups": [{"Ref" : "SecurityGroup"}, "default"] }
}
}
}
}
}
[/code]
Tags: autoscaling,  heat,  OpenStack,  tutorial

Written by Gabriel Moldoveanu

Related Posts
  • OpenSSH server – Enable and secure on Ubuntu 16.04 LTS

  • NodeJS install on Ubuntu 16.04 LTS (Xenial Xerus)

Leave a Reply

Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

← Openstack HEAT tutorials: 1. Deploying an instance with haproxy installed and configured for basic HTTP load balancing
Openstack HEAT tutorials: 3. Autoscaling with Ceilometer →

Latest tweet

Couldn't retrieve tweets! Wrong username?