Apache CloudStack PoCGuide 2025 ShapeBlue
Apache CloudStack PoCGuide 2025 ShapeBlue
I N S TA L L AT I O N A N D U S E C A S E S
UPDATED
2025
Apache CloudStack
Proof-of-Concept Guide
Installation and Operation Instructions
Table of Contents
INTRODUCTION ............................................................................................................................................... 3
ABOUT THIS GUIDE .......................................................................................................................................... 5
CLOUDSTACK INSTALL GUIDE .......................................................................................................................... 7
HARDWARE REQUIREMENTS ...................................................................................................................................... 8
SOFT REQUIREMENTS ............................................................................................................................................... 9
INFRASTRUCTURE DESIGN ......................................................................................................................................... 9
MANAGEMENT SERVER SETUP OVERVIEW.................................................................................................................. 10
PREPARING THE MANAGEMENT SERVER .................................................................................................................... 11
INSTALLING CLOUDSTACK........................................................................................................................................ 12
PREPARING THE NFS SHARES................................................................................................................................... 12
INSTALLING THE DATABASE SERVER ........................................................................................................................... 12
KVM HYPERVISOR SETUP ....................................................................................................................................... 14
PREPARING THE OPERATING SYSTEM ......................................................................................................................... 14
INSTALL AND CONFIGURE THE CLOUDSTACK AGENT ..................................................................................................... 15
INSTALLING AND CONFIGURING LIBVIRT ..................................................................................................................... 16
CONFIGURING THE NETWORKING ............................................................................................................................. 17
ADDING A CLOUDSTACK ZONE ................................................................................................................................. 18
DOMAIN HIERARCHY, USER ACCOUNTS AND RESOURCE LIMITS ....................................................................33
OVERVIEW ........................................................................................................................................................... 34
TOPICS COVERED ................................................................................................................................................... 34
ACCESSING THE CONTROL PANEL .............................................................................................................................. 34
CREATING A DOMAIN ............................................................................................................................................. 35
LIMITING RESOURCES AT THE DOMAIN LEVEL .............................................................................................................. 36
ADDING A DOMAIN ADMINISTRATOR ACCOUNT .......................................................................................................... 37
ADDING A USER ACCOUNT AND SETTING LIMITS .......................................................................................................... 40
MANAGING GUEST INSTANCES .......................................................................................................................42
OVERVIEW ........................................................................................................................................................... 43
TOPICS COVERED................................................................................................................................................... 43
ACCESSING THE CONTROL PANEL .............................................................................................................................. 43
REGISTERING A NEW TEMPLATE................................................................................................................................ 44
CREATING A GUEST NETWORK AND MANAGING EGRESS RULES ...................................................................................... 46
REGISTERING A USERDATA ...................................................................................................................................... 49
CREATING AN INSTANCE RUNNING A WEB SERVER ....................................................................................................... 51
CONFIGURING FIREWALL AND PORT FORWARDING FOR PUBLIC WEB SERVER ACCESS ......................................................... 51
SCALING UP/DOWN GUEST INSTANCES ..................................................................................................................... 55
REMOVING AND RECOVERING INSTANCES................................................................................................................... 57
VIRTUAL PRIVATE CLOUD ...............................................................................................................................61
OVERVIEW ........................................................................................................................................................... 62
TOPICS COVERED ................................................................................................................................................... 62
VPC ARCHITECTURE OVERVIEW ............................................................................................................................... 62
CREATING A VPC .................................................................................................................................................. 64
CREATING ACL LISTS.............................................................................................................................................. 65
CREATING NETWORK TIERS ..................................................................................................................................... 69
REGISTERING A MANAGED USERDATA SCRIPT FOR THE BACKEND INSTANCES .................................................................... 72
CREATING BACKEND INSTANCES ............................................................................................................................... 73
Introduction
Apache CloudStack is the leading open-source cloud orchestration platform, used by many of the
world’s largest public and private clouds. It is a multi-hypervisor, multi-tenant, high-availability
Infrastructure as a Service (IaaS) cloud management platform.
CloudStack provides a cloud orchestration layer, automating the creation, provisioning, and
configuration of IaaS components (such as virtual servers). It transforms existing virtual infrastructure
into a cloud-based IaaS platform. By leveraging existing infrastructure, CloudStack significantly reduces
the cost and time required for organizations to build a multi-tenant IaaS platform.
One of the platform’s key advantages is its simplicity and ease of use, even in large-scale environments.
With CloudStack, you can seamlessly orchestrate public, on-premises, and hybrid cloud environments
without the need for a large operations team to manage them over time.
As more organizations build on-premises clouds or enter the service provider market with public clouds,
the demand for the right set of tools to build, manage, and scale IaaS platforms continues to grow.
However, choosing the appropriate technology stack can be challenging. Several factors must be
considered, including future growth, team size, budget, project timelines, previous experience, available
hardware, and existing infrastructure.
This Lab Guide provides detailed operational instructions designed to assist in the PoC evaluation
process. By following our PoC guide, you will ensure the creation of a fully functional and thoroughly
tested cloud management system. Additionally, you’ll gain a clear understanding of what to expect from
the technology and how to configure everything in a timely and efficient manner.
By the end of this PoC, you will have a highly available, reliable, and flexible CloudStack-powered cloud.
You will gain the confidence to set up and manage a CloudStack IaaS, ensuring the smooth
implementation of the cloud orchestration layer into your infrastructure.
Conventions
The following conventions are used to highlight important areas and required inputs:
Highlight a button/item from the list in the GUI that requires direct interaction.
Highlighted text which can be copied and pasted directly into the UI.
Highlight text which can be copied and pasted directly into the command prompt.
Note
Warning
Warning
Hardware requirements
To establish a functional architecture for Apache CloudStack evaluation, the following
hardware is the minimum requirement.
Storage
Primary and Secondary storage created as NFS exports on the CloudStack Management server
500GB of RAID based storage on CloudStack Management server
Hosts
Item Quantity/Description
No. hosts (per cluster required) 3
Clusters/Pods (1 cluster per pod) 1
No. cores (per host) 8
Memory (per host) 32-64GB
Local storage Disk to support Hypervisor/OS
Network Interfaces 2 Ethernet cards
Network throughput 1Gb/s
Management Server
Item Quantity/Description
No. cores 8
Memory 16GB
Local storage 150GB for OS + 500GB for primary and secondary storage of RAID based storage
Network Interfaces 1 Ethernet card
Network throughput 1Gb/s
Networking
Item Quantity/Description
No. Switches 1
VLAN 802.1q support required for advanced network zones.
No. ports Enough ports to connect 2 interfaces on each host considering 1 port for public/guest
networks and 1 port for storage/management (+) 1 interface for
storage/management network for the CloudStack management server.
Throughput 1 Gb/s
Soft Requirements
Note
Infrastructure Design
Physical Layout
Switch for
Management / Storage
and Public/Guest
Networks
Logical Layout
Warning
Warning
hostname -f
Note
Note
A NTP daemon is required to synchronize the clocks of the servers in your cloud.
vi /etc/selinux/config
SELINUX=enforcing
SELINUX=permissive
setenforce permissive
Installing CloudStack
[cloudstack]
name=cloudstack
baseurl= [Link]
enabled=1
gpgcheck=1
gpgkey=[Link]
Warning
Note
Apache CloudStack requires space for Primary and Secondary Storage (refer to the CloudStack Design). Both
storage types can be configured using NFS shares. This section explains how to set up the NFS shares before
adding the storage to CloudStack.
mkdir -p /export/primary
mkdir -p /export/secondary
vi /etc/exports
/export *(rw,async,no_root_squash,no_subtree_check)
exportfs -a
vi /etc/[Link].d/[Link]
server_id=1
innodb_rollback_on_timeout=1
innodb_lock_wait_timeout=600
max_connections=350
log-bin=mysql-bin
binlog-format = 'ROW'
Database cloud
User cloud
Password password
cloudstack-setup-management
systemctl enable cloudstack-management
systemctl start cloudstack-management
Note
The Management Server should now be up and running.
Note
Before continuing, ensure that the latest updates have been applied to the hosts.
Warning
The procedure for installing the Hosts include the following steps:
Prepare the Operating System
Install and configure libvirt
Configure Security Policies (SELinux)
Install and configure the Agent
hostname -f
Note
Note
A NTP daemon is required to synchronize the clocks of the servers in your cloud.
vi /etc/selinux/config
SELINUX=enforcing
SELINUX=permissive
setenforce permissive
[cloudstack]
name=cloudstack
baseurl= [Link]
enabled=1
gpgcheck=1
gpgkey=[Link]
Warning
Note
listen_tls = 0
listen_tcp = 1
tcp_port = 16509
auth_tcp = “none”
mdns_adv = 0
Note
LIBVIRTD_ARGS=-l
Note
Warning
Note
Note
Note
1. To access the CloudStack UI, open the following URL in your web browser:
[Link]
2. Login using the following credentials, then click Login.
Username: admin
Password: password
Domain: Blank
3. In the left of navigation pane, click Infrastructure > Zones, then click Add Zone.
4. In the wizard, select Core, click Next and then, on the next page, select Advanced to
create an Advanced Zone and click Next again.
Note
5. Fill in the informations required for Zone Details as follows and then click Next.
Name: poc-zone
IPv4 DNS1: [Link]
Internal DNS 1: [Link]
Hypervisor: KVM
Default guest CIDR for Isolated Networks: [Link]/24
6. Next, configure traffic types for the hosts’ physical networks. Click Add Physical Network
to create a new physical network and configure the Traffic Types as follows:
7. Remove Guest and Public traffics from Physical Network 1 clicking on the garbage bin
button for both.
8. Add Guest and Public traffic in the Physical Network 2 by clicking on Add Traffic button
and then, click Add button:
9. Click Edit (the pencil button) for each traffic type and set the traffic label as follows. Once
all traffic labels are defined, click Next:
cloudbr0
10. Next, configure the Public traffic and add public IPs to be used by the Virtual Routers and
System VMs on the public NIC. Complete the form as follows, click Add, and then click
Next:
Gateway: [Link]
Netmask: [Link]
VLAN/VNI: 48
Start IP: [Link]
End IP: [Link]
Note
11. Complete the form to create and setup the POD, then click Next.
Note
12. Next, configure the Guest Traffic VLANs, then click Next.
13. Next, complete the form with the Cluster name, then click Next.
Cluster Name: cluster01
14. Add the first host, then click Next. Additional hosts will be added once the Zone is ready.
Host Name: [Link]
Username: root
Password: <the root password>
Tags: Blank
15. Complete the form as follows to add a NFS Primary Storage, then click Next.
Name: Primary Storage
Scope: Cluster
Protocol: nfs
Server: [Link]
Path: /export/primary
NFS mount options: Blank
Provider: DefaultPrimary
Storage Tags: Blank
16. Complete the form as follows to add a NFS Secondary Storage, then click Next.
Provider: NFS
Name: Secondary Storage
Server: [Link]
Path: /export/secondary
18. The Zone will be ready after all resources is configured. Click Enable Zone to finish the
wizard.
19. Add the remaining hosts by clicking Infrastructure > Hosts in the left navigation pane,
then click Add Host.
Overview
Apache CloudStack implements domain hierarchies to logically isolate user accounts. This
model can be used to define, for example, departments within the same organization if used
to building on-premises clouds or, different customers when building public clouds. You could
also have a specific domain for sales partners or customers for example.
A domain can contain multiple user accounts. In Apache CloudStack, a user account assumes
a profile defined in roles. There is a set of predefined roles for the most common user
profiles, these being the main ones:
Role Description
Root Admin Manages the entire platform, including physical and logical resources across all domains
and accounts.
Domain Admin Manages all logical resources within the domain and its sub-domains, including user
accounts, sub-domains, and all related virtual computing resources.
User Manages virtual computing resources associated with the user’s own account.
Topics covered
• Managing Domains
• Setting Resource Limits
• Managing User Accounts
Creating a Domain
Note
Name: POC
Network Domain: Blank
Domain: Blank
Note
This screen displays the computing resource limits at the domain level. By default, the resources are set to -1,
which indicates unlimited resource.
Username: admin
Password: password
Domain: poc
Role: User
Username: user-1
Password: password
Confirm Password: password
Email: user-1@[Link]
First Name: User-1
Last Name: PoC Domain
Domain: ROOT/POC
Account: poc-user-account
Timezone: <select yours>
Network Domain: Blank
Overview
This instruction provides you with a basic overview of launching, resizing, and managing an Apache
CloudStack Instance.
Apache CloudStack offers a user-friendly interface that simplifies obtaining and configuring capacity It
gives users full control over their computing resources and operates within a reliable, proven
environment.
CloudStack significantly reduces the time needed to provision and boot new virtual machine Instances
to just minutes, enabling you to quickly scale capacity up or down as your computing requirements
change.
Topics Covered
• Download Template
• Create an Isolated Network
• Modify egress firewall rules
• Launch an Instance
• Using Userdata
• Manage Firewall
• Scale up/down Instance
• Instance console access
• Destroy Instance
• Recover Instance
• Expunge Instance
Username: user-1
Password: password
Domain: poc
Note
You will use a pre-configured template that includes cloud-init, which is set up to run commands during
Instance startup.
URL: [Link]
Name: Debian 11
Description: Debian GNU/Linux 11 (64-bit)
Zone: poc-zone
Hypervisor: KVM
Format: QCOW2
Root disk controller: virtio
OS Type: Debian GNU/Linux 11 (64-bit)
Template Type: USER
Userdata: None
Userdate link policy: None
Extratable: No
Dynamically Scalable: Yes
Public: Yes
Password Enabled: Yes
HVM: Yes
Note
An Apache CloudStack guest network provides a VLAN-isolated layer that connects the Instance network to
the Virtual Router gateway.
Note
The Virtual Router handles network communication between Instances and the public network. It also
manages firewall rules, userdata, metadata, DHCP for Instances, load balancing, Remote VPN, and TCP/UDP
port forwarding.
Name: my-isolated-network
Description: My Isolated Network
Zone: Poc Zone
Network Offering: Offering for Isolated networks with Source Nat service enabled
External Id: Blank
Gateway: Blank
Netmask: Blank
DNS 1: Blank
DNS 2: Blank
Ipv4 address for the VR in this network: Blank
Network Domain: Blank
Note
During the creation of an Isolated Network, the parameters Gateway, Netmask, DNS 1, DNS 2, and Ipv4
address for the VR in this network can be customized. However, if left blank, these parameters will inherit the
default values from the Zone configuration.
Click Egress Rules and add a rule to allow Instances to access the internet as follows. Then
click Add.
Registering a UserData
Note
When creating an Instance, you can use Managed UserData to customize its configuration during the boot
process. Managed UserData lets you define settings, scripts, or commands that are automatically applied
when the Instance starts. This can include tasks such as installing software, configuring services, or setting
environment variables.
In the left navigation pane, click Compute > User Data, then click Register a userdata.
Name: webserver
Userdata: #! /bin/bash
apt update
apt install -y apache2
echo '<html><h2>Hello from your new WebServer!</h2></html>' >
/var/www/html/[Link]
systemctl enable --now [Link]
systemctl restart [Link]
Base64 encoded: No
Userdata parameters: Blank
In the left navigation pane, click Compute > Instances, then click Add Instance.
Zone: poc-zone
Template: Debian 11
Compute Offering: Small Instance
Advanced Mode: Yes
- Stored Userdata: webserver
Name: WebServer01
Group: None
Keyboard Language: None
Start Instance: Yes
Configuring Firewall and Port Forwarding for Public Web Server Access
Click the Firewall tab, complete the form as follows, and then click Add.
Open a new browser tab, paste the copied address, and press enter:
Note
The Web Server is now running.
Note
Compute offering in Apache CloudStack define the specifications for virtual machine Instances, such as CPU,
memory, network rate, and disk size. These offerings are critical for ensuring that Instances have the
necessary resources to meet performance and capacity requirements.
Username: admin
Password: password
Domain: poc
Username: user-1
Password: password
Domain: poc
Note
When an Instance is destroyed by a regular user account, it may appear as permanently removed from the
user’s view. However, if the Global Setting [Link] variable is set to true, users can view
and recover such destroyed Instances. By default, this setting is false, meaning users cannot see or recover
destroyed Instances.
Username: admin
Password: password
Domain: poc
Note
A domain admin account has the capability to manage destroyed Instances, which includes the ability to both
recover and permanently purge these Instances. This functionality allows domain admins to handle Instances
that regular users have destroyed but not permanently removed. Here’s what a domain admin can do:
Username: user-1
Password: password
Domain: poc
Overview
Virtual Private Cloud (VPC) enables you to create an architecture that mimics a traditional
physical network. Key features of VPC include:
Client VPN
Enables remote users to securely connect to your network using a VPN client. This
feature is available for both VPCs and Isolated Network setups, offering secure access
for remote connections regardless of the network structure.
Topics covered
• How to create VPC
• How to create ACLs List
• How to create VPC subnets
• How to create internal and external Load Balancer
In this step, you will design and implement a simple architecture to showcase the capabilities
of Virtual Private Cloud (VPC) components for delivering services. Here’s how the architecture
will be structured:
• Define VPC CIDR: Allocate a CIDR block for your VPC to segment network traffic. This
CIDR block will be further divided into subnets to organize and manage traffic
flow,by creating different Networks inside VPC.
• Subnetting
o Frontend Subnet: ([Link]/25) This subnet will manage incoming traffic
from the internet, distributing it to frontend instances through load
balancing to ensure high availability and efficient content delivery.
o Backend Subnet: ([Link]/25): This subnet will handle processing and
serving content, accessible only via the frontend subnet. Internal load
balancing will manage traffic between backend instances for scalable
processing.
• Instances
o Frontend Instances: Deploy 2 Instances in the frontend subnet. These will
handle external user requests and distribute traffic.
o Backend Instances: Deploy 3 Instances in the backend subnet. These will
process requests and provide content.
• Load Balancing:
o External Load Balancer: Set up a load balancer in the frontend subnet to
distribute incoming traffic across the frontend Instances using a round-robin
algorithm.
Creating a VPC
Username: user-1
Password: password
Domain: poc
1. In the left navigation pane, click Network > VPC, then click Add VPC.
Name: My VPC
Description: Blank
Zone: poc-zone
CIDR: [Link]/24
Network Domain: Blank
VPC Offering: Default VPC Offering
DNS 1: Blank
DNS 2: Blank
IPv4 address for the VR in this Network: Blank
Start: yes
Note
Before setting up the VPC networks, we will first create the necessary ACLs to control access for each VPC
network tier.
3. In the VPC list, select My VPC, then click Network ACL Lists. A list of default ACLs will be
displayed.
4. Add two new ACLs, one for Frontend and one for Backend. Click Add Network ACL List,
and complete the form to create the Frontend ACL List as follow. Once done, click OK:
5. Click Add Network ACL List again to create the Backend ACL List, and follow the same
process as before.
6. Click ACL-FE, select ACL list Rules to add an rule that denies all incoming traffic from the
backend tier. Click Add ACL and complete the form as specified, and then click OK.
#Rule: 1
CIDR List: [Link]/25
Action: Deny
Protocol: All
Traffic Type: Ingress
Description: Deny all ingress traffic from backend tier.
7. Return to ACL lists and click ACL-BE, then click ACL List Rules. Add a rule to allow incoming
HTTP traffic (port 80) from the frontend tier by clicking Add ACL button and complete the
form as specified, then click OK.
#Rule: 1
CIDR List: [Link]/25
Action: Allow
Protocol: TCP
Start Port: 80
End Port: 80
Traffic Type: Ingress
Description: Allow http ingress traffic from frontend tier.
8. Click Add ACL again to deny any other ingress traffic from the frontend. Complete the
form as specified, and then click OK.
#Rule: 2
CIDR List: [Link]/25
Action: Deny
Protocol: All
Traffic Type: Ingress
Description: Deny all ingress traffic from frontend tier.
10. Click the Networks tab, then click Add new Network Tier.
12. Click the Networks tab, then click Add new Network Tier again.
13. In the left navigation pane, go to Compute > User Data, then click Register a userdata.
Note
To create each of the three backend Instances, modify only the Name field as follows: backend-Instance-01,
backend-Instance-02, backend-Instance-03.
Zone: poc-zone
Template: Debian 11
Compute Offering: Small Instance
Networks:
- Backend Tier: Yes
- Frontend Tier: No
Advanced Mode: Yes
- Stored Userdata: backend-webserver
Name: backend-Instance-0[1,2,3]
Group: None
Keyboard Language: None
Start Instance: Yes
18. In the left navigation pane, go to Network, select VPC, then select My VPC.
19. Click the Networks tab, expand the Internal LB menu, and then click Add Internal LB.
23. Click the Assigned Instances tab, then click Assign Instance.
25. In the left navigation pane, go to Compute and select User Data. Then click Register a
userdata.
26. Complete the form as follows, then click OK to create the userdata.
Name: frontend-webserver
Userdata: ## template: jinja
#cloud-config
package_update: true
packages:
- apache2
runcmd:
- a2enmod cgid
- sed -i '/<Directory \/var\/www\/>/!b;n;c\ Options Indexes
FollowSymLinks ExecCGI' /etc/apache2/[Link]
- sed -i 's|<Directory /var/www/>|<Directory /var/www/html>|'
/etc/apache2/[Link]
- sed -i 's/DirectoryIndex .*/DirectoryIndex [Link]/' /etc/apache2/mods-
available/[Link]
- sed -i 's|#AddHandler cgi-script .cgi|AddHandler cgi-script .py|'
/etc/apache2/mods-available/[Link]
- rm -rf /var/www/html/[Link]
-|
cat << EOF > /var/www/html/[Link]
#! /usr/bin/env python3
import requests
import socket
h = [Link]()
r = [Link]("[Link] ds.meta_data.internal_lb }}/")
print("Content-type: text/html\n\n")
print("<html>\n<body>")
print("<meta http-equiv=\"refresh\" content=\"10\"/>")
print("<div style=\"width: 100%; font-size: 40px; font-weight: bold; text-align:
center;\">")
print('%s - %s' % (h, [Link]))
print("</div>\n</body>\n</html>")
EOF
- chmod 705 /var/www/html/[Link]
- systemctl enable --now [Link]
- systemctl restart [Link]
Base64 encoded: No
Userdata parameters: internal_lb
Note
When completing the Instances form, set the internal_lb key to the value copied from step 21. Additionally,
update the Name field as follows: frontend-Instance-01, frontend-Instance-02.
28. Complete the forms for frontend-Instance-01 and frontend-Instance-02, ensuring the
internal_lb value is set correctly. Then, click Launch Instance. The internal_lb setting is
crucial for enabling proper load balancing across the backend tier Instances behind the
Internal Load Balancer.
Zone: poc-zone
Template/ISO: Debian 11
Compute Offering: Small Instance
Networks:
- Backend Tier: No
- Frontend Tier: Yes
Advanced Mode: Yes
- Stored Userdata: backend-webserver
internal_lb: [Link]
Name: frontend-Instance-0[1,2]
Group: None
Keyboard Language: None
Start Instance: Yes
Creating and Configuring the External Load Balancer for Frontend Tier
29. In the left navigation pane, go to Network > VPC, and then click My VPC.
30. Select the Public IP Address tab, then click Acquire New IP. Choose one IP Address from
the list, then click OK.
33. Click the Load Balancing tab, complete the form as specified, and then click Add.
Name: www
Public port: 80
Private port: 80
CIDR list: Blank
Algorithm: Round-robin
Protocol: TCP
AutoScale: No
34. Select the tier Frontend Tier, choose all Instances from the list, and then click OK.
Note
The web page will refresh automatically every 10 seconds. Each time the page reloads, you will see both the
frontend and backend hostnames change. This demonstrates the load balancing in action, as the frontend
Instance connects to different backend Instances via the internal load balancer, displaying the hostname of
each Instance handling the request.
Overview
Apache CloudStack provides an Autoscaling feature that enables automatic scaling of
Instances in response to changes in demand. This is particularly useful for environments
where workloads fluctuate, allowing resources to be dynamically adjusted based on
predefined conditions or thresholds. Autoscaling is commonly used in both private and public
cloud environments, ensuring that the necessary compute resources are available during
peak times while minimizing costs during low usage periods.
The Autoscaling functionality in CloudStack integrates with the Virtual Router, which acts as a
load balancer for distributing incoming traffic across multiple Instances. Based on pre-
configured metrics, CloudStack will automatically increase (scale-out) or decrease (scale-in)
the number of Instances to meet the demand. This provides a seamless way to manage
resources efficiently without manual intervention.
Autoscaling relies on performance counters to monitor the state of the Instances. The
following key metrics can be used to trigger scaling actions:
In a typical setup, an Autoscaling Group defines the rules and conditions for scaling, including
the minimum and maximum number of Instances, health checks, and the metrics to monitor.
The Autoscaling Group ensures that the appropriate number of Instances are always running
to handle traffic, scaling up when necessary and removing unneeded Instances during quieter
periods.
Topics covered
• Creating Load Balancer with Autoscaling enabled
• Creating specific UserData
• Creating Autoscale Instance Group
• Simulating Autoscaling using Apache Benchmark
Username: user-1
Password: password
Domain: poc
Name: autoscaling-network
Description: Autoscaling Network
Zone: Poc Zone
Network Offering: Offering for Isolated networks with Source Nat service enabled
External Id: Blank
Gateway: Blank
Netmask: Blank
DNS 1: Blank
DNS 2: Blank
Ipv4 address for the VR in this network: Blank
Network Domain: Blank
Click Egress Rules and add a rule to allow Instances to access the internet as follows. Then
click Add.
Source CIDR: [Link]/24
Destination CIDR: [Link]/0
Protocol: All
Now, click on Public IP addresses tab and acquire 2 new IP addresses by clicking on Acquire
new IP button.
The two Public IP addresses will be displayed, with one of them serving as the Source NAT
and the other designated for the Load Balancer.
Now, click on Firewall tab and enable incoming http connections completing the form as
follows and then, click Add.
Source CIDR: Blank
Protocol: TCP
Start port: 80
End port: 80
Click on Load balancing tab and complete the form as follows and then, click Add:
Name: my-autoscaling-app
Public port: 80
Private port: 80
CIDR list: Blank
Algorithm: Round-robin
Protocol: TCP
AutoScale: Yes
In the left navigation pane, go to Compute > User Data, then click Register a userdata.
Base64 encoded: No
Userdata parameters: Blank
Note
The managed UserData script for the Autoscaling Instances Group automates the configuration of the Apache
web server to run CGI scripts in Python. It enables the CGI module and updates the Apache configuration to
allow CGI script execution in the /var/www/html/ directory. The default file to be served is changed to
[Link], which is set to be treated as a CGI script. The [Link] script fetches the hostname of backend
instances and displays it alongside the frontend hostname. A sleep 5 command is included in the script to
simulate a slight delay, which is useful for testing how the Autoscaling system handles load and latency under
real-world conditions, allowing users to observe the scaling behaviour in action.
In the left navigation pane, go to Compute > AutoScale Instance Groups, then click New
AutoScale Instance Group.
The form New AutoScale Instance Group will be shown. First, select a Zone where the
Autoscaling Group will be created.
Note
In this simulation example, we will create a ScaleUp and ScaleDown Policies based on the number of load
balancer connections per Instance. The values used are reduced and do not reflect a real-world scenario. The
purpose here is to demonstrate the concept and illustrate how the scaling mechanism works. This simplified
approach focuses on applying the principles of Autoscaling and understanding its functionality rather than
replicating production-level scaling conditions.
Complete the form to create a Scale Up Policy, then click Add condition.
Name: ScaleUpPolicy-0
Duration (in sec): 20
Quiet time (in sec): 20
Counter: Load Balancer - average connections per vm
Operator: Greater than
Threshold: 1
Note
The ScaleUp Policy defines the conditions under which an AutoScale Instance Group will automatically scale
up, meaning new Instances will be added to handle increased demand. When creating an AutoScale Instance
Group, at least one ScaleUp policy is required. The scaling process is triggered when all conditions in the
ScaleUp policy are met.
Next, complete the form to create a Scale Down Policy, then click Add condition.
Name: ScaleDownPolicy-0
Duration (in sec): 20
Quiet time (in sec): 20
Counter: Load Balancer - average connections per vm
Operator: Less than
Threshold: 1
Note
The ScaleDown Policy defines the conditions under which an AutoScale Instance Group will automatically
scale down, meaning Instances will be removed when demand decreases. Unlike the ScaleUp Policy, the
ScaleDown policy ensures that resources are reduced when conditions meet specified thresholds. The scaling
down process is triggered when all conditions in the ScaleDown policy are satisfied, and the system will
decrease the number of Instances to optimize resource usage during lower demand periods.
To finish the AutoScale Instance Group creation, complete the fields in the Details section
and then click Create.
Name: webserver-autoscaling-group
Expunge Instance grace period (in sec): 20
Max members: 3
Min members: 1
Polling interval (in sec): 20
Note
The Expunge Instance Grace Period (20 seconds) defines the time an instance will remain in the system
before being permanently removed after it is marked for expunging. The Max Members is set to 3, meaning
the AutoScaling Group can have up to 3 Instances running simultaneously, while the Min Members is set to 1,
ensuring at least one Instance is always running. The Polling Interval (20 seconds) specifies how frequently
the system checks the scaling conditions, determining whether to scale up or down based on the current load
and metrics.
The webserver-autoscaling group is now listed on the AutoScale Instance Group page.
Click on it to view or manage its details.
Next, click on the Events tab. Here, you can view all SCALEUP events related to the
AutoScale Instance Group.
Related to the SCALEUP event, as defined in the AutoScale Instance Group, an Instance
will be created based on the minimum number of Instances specified.
To generate traffic in the load balancer, copy the IP address from the webserver-
autoscaling Autoscaling Group in the Details page.
Next, open a terminal on your desktop and run the following command, replacing
ip_address with the AutoScale Instance Group IP address you copied earlier.
ab -n 200 -c 4 [Link]
Note
The Apache Benchmark (ab -n 200 -c 4 [Link] command will send 200 total requests to the
specified IP address, with 4 concurrent requests at a time. Given that the webpage has a 5-second delay (due
to the [Link](5) in the Python script), the overall time for the load test will account for the processing of
each request. Depending on network latency and server response times, this will help simulate load and
observe the behaviour of the Autoscaling Group under stress, especially as it scales to meet demand.
As the Apache Benchmark command continues generating traffic to the load balancer
endpoint, the SCALEUP trigger will keep scaling the number of Instances until the
maximum limit defined in the AutoScale Instance Group is reached.
When the Apache Benchmark command completes, the SCALEDOWN trigger will be
executed, and the instances will be removed until the number of Instances returns to the
minimum defined in the AutoScale Instance Group.
For additional information and support, you can explore the following resources:
• Apache CloudStack Official Website: Visit the CloudStack website to learn more about
its features, updates, and community.
Apache CloudStack is the leading open source cloud orchestration platform, in use by
many of the world’s largest public and private clouds. It is a multi-hypervisor, multi-
tenant, high-availability Infrastructure as a Service cloud management platform. CloudStack
is software that provides a cloud orchestration layer, giving automation of the creation,
provisioning and configuration of IaaS components.
info@[Link] [Link]