20dit057 Ac
20dit057 Ac
Practical – 1
Theory:
It’s a framework for modeling and simulation of cloud computing infrastructures and
services.
CloudSim supports modeling and simulation of cloud computing data centers,
virtualized hosts, allocation policies, network topologies and message passing
applications. Moreover, the framework can be integrated with Eclipse and NetBeans,
allowing you to code in Java.
Implementation:
1. Download NetBeans and Install it.
2. Download CloudSim and unzip it.
3. Once Netbeans IDE is installed, start creating a new Project via File > New Project.
Choose “Java” under Categories and “Java Application” under Projects.
DEPSTAR (IT) 1
IT442 : ADVANCED COMPUTING 20DIT057
Figure 1.1
Name your project and click “Finish” button.
Figure 1.2
DEPSTAR (IT) 2
IT442 : ADVANCED COMPUTING 20DIT057
On the left sidebar, right click on the project and select “Properties” as shown below:
Figure 1.3
In the properties dialog, select “Libraries” and click on “Add Library” button at the right. In
the “Add Library” dialog, select cloudsim jar file (will be located in jars folder) downloaded
in step 2. Now you can drag and drop example programs (under
examples/org/cloudbus/cloudsim) from the CloudSim directory into your application. That’s
it, your CloudSim toolkit it ready to use.
Figure 1.4
DEPSTAR (IT) 3
IT442 : ADVANCED COMPUTING 20DIT057
Figure 1.5
Conclusion:
From this practical, I learned about how to install and configure CloudSIm step by step in
Netbeans IDE.
DEPSTAR (IT) 4
IT442 : ADVANCED COMPUTING 20DIT057
Practical – 2
Aim: Cloud Computing aims for Internet based application services to deliver reliable,
secure, fault - tolerant, scalable infrastructure. It is a tremendous challenging task to model
and schedule the different applications and services on real cloud infrastructure which
requires to handle different workload and energy performance parameters. Consider the real-
world analogy into cloudsim and
Perform following Programs:
1. Write a program in cloudsim using NetBeans IDE to create a datacenter with one host
and run four cloudlets on it.
Implementation:
/*
* Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
*
* Copyright (c) 2009, The University of Melbourne, Australia
*/
//package org.cloudbus.cloudsim.examples;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.CloudletSchedulerTimeShared;
import org.cloudbus.cloudsim.Datacenter;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.DatacenterCharacteristics;
import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Pe;
import org.cloudbus.cloudsim.Storage;
import org.cloudbus.cloudsim.UtilizationModel;
import org.cloudbus.cloudsim.UtilizationModelFull;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.VmAllocationPolicySimple;
import org.cloudbus.cloudsim.VmSchedulerTimeShared;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.provisioners.BwProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.RamProvisionerSimple;
DEPSTAR (IT) 5
IT442 : ADVANCED COMPUTING 20DIT057
/**
* A simple example showing how to create
* a datacenter with one host and run two
* cloudlets on it. The cloudlets run in
* VMs with the same MIPS requirements.
* The cloudlets will take the same time to
* complete the execution.
*/
public class CloudSimExample2 {
/**
* Creates main() to run this example
*/
public static void main(String[] args) {
Log.printLine("Starting CloudSimExample2...");
try {
// First step: Initialize the CloudSim package. It should be called
// before creating any entities.
int num_user = 1; // number of cloud users
Calendar calendar = Calendar.getInstance();
boolean trace_flag = false; // mean trace events
//VM description
int vmid = 0;
int mips = 250;
long size = 10000; //image size (MB)
int ram = 512; //vm memory (MB)
DEPSTAR (IT) 6
IT442 : ADVANCED COMPUTING 20DIT057
long bw = 1000;
int pesNumber = 1; //number of cpus
String vmm = "Xen"; //VMM name
vmid++;
Vm vm2 = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size,
vmm, new CloudletSchedulerTimeShared());
vmid++;
Vm vm3 = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size,
vmm, new CloudletSchedulerTimeShared());
vmid++;
Vm vm4 = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size,
vmm, new CloudletSchedulerTimeShared());
//Cloudlet properties
int id = 0;
pesNumber=1;
long length = 250000;
long fileSize = 300;
long outputSize = 300;
UtilizationModel utilizationModel = new UtilizationModelFull();
id++;
Cloudlet cloudlet2 = new Cloudlet(id, length, pesNumber, fileSize,
outputSize, utilizationModel, utilizationModel, utilizationModel);
cloudlet2.setUserId(brokerId);
DEPSTAR (IT) 7
IT442 : ADVANCED COMPUTING 20DIT057
id++;
Cloudlet cloudlet3 = new Cloudlet(id, length, pesNumber, fileSize,
outputSize, utilizationModel, utilizationModel, utilizationModel);
cloudlet3.setUserId(brokerId);
id++;
Cloudlet cloudlet4 = new Cloudlet(id, length, pesNumber, fileSize,
outputSize, utilizationModel, utilizationModel, utilizationModel);
cloudlet4.setUserId(brokerId);
CloudSim.stopSimulation();
printCloudletList(newList);
}
catch (Exception e) {
e.printStackTrace();
Log.printLine("The simulation has been terminated due to an unexpected
error");
}
}
private static Datacenter createDatacenter(String name){
// Here are the steps needed to create a PowerDatacenter:
// 1. We need to create a list to store
// our machine
List<Host> hostList = new ArrayList<Host>();
DEPSTAR (IT) 8
IT442 : ADVANCED COMPUTING 20DIT057
//4. Create Host with its id and list of PEs and add them to the list of machines
int hostId=0;
int ram = 2048; //host memory (MB)
long storage = 1000000; //host storage
int bw = 10000;
hostList.add(
new Host(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList,
new VmSchedulerTimeShared(peList)
)
); // This is our machine
DEPSTAR (IT) 9
IT442 : ADVANCED COMPUTING 20DIT057
return datacenter;
}
//We strongly encourage users to develop their own broker policies, to submit
vms and cloudlets according
/**
* Prints the Cloudlet objects
* @param list list of Cloudlets
*/
private static void printCloudletList(List<Cloudlet> list) {
int size = list.size();
Cloudlet cloudlet;
String indent = " ";
Log.printLine();
Log.printLine("========== OUTPUT ==========");
Log.printLine("Cloudlet ID" + indent + "STATUS" + indent +
"Data center ID" + indent + "VM ID" + indent + "Time" + indent + "Start
Time" + indent + "Finish Time");
if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS){
Log.print("SUCCESS");
DEPSTAR (IT) 10
IT442 : ADVANCED COMPUTING 20DIT057
indent + dft.format(cloudlet.getExecStartTime())+
indent + indent + dft.format(cloudlet.getFinishTime()));
}
}
}
}
Output:
Figure 2.1
DEPSTAR (IT) 11
IT442 : ADVANCED COMPUTING 20DIT057
2. Write a program in cloudsim using NetBeans IDE to create a datacenter with three
host and run three cloudlets on it.
Implementation:
/*
* Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
*
* Copyright (c) 2009, The University of Melbourne, Australia
*/
//package org.cloudbus.cloudsim.examples;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.CloudletSchedulerTimeShared;
import org.cloudbus.cloudsim.Datacenter;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.DatacenterCharacteristics;
import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Pe;
import org.cloudbus.cloudsim.Storage;
import org.cloudbus.cloudsim.UtilizationModel;
import org.cloudbus.cloudsim.UtilizationModelFull;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.VmAllocationPolicySimple;
import org.cloudbus.cloudsim.VmSchedulerTimeShared;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.provisioners.BwProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.RamProvisionerSimple;
/**
* A simple example showing how to create
* a datacenter with two hosts and run two
* cloudlets on it. The cloudlets run in
* VMs with different MIPS requirements.
* The cloudlets will take different time
* to complete the execution depending on
* the requested VM performance.
*/
public class CloudSimExample3 {
DEPSTAR (IT) 12
IT442 : ADVANCED COMPUTING 20DIT057
DEPSTAR (IT) 13
IT442 : ADVANCED COMPUTING 20DIT057
DEPSTAR (IT) 14
IT442 : ADVANCED COMPUTING 20DIT057
DEPSTAR (IT) 15
IT442 : ADVANCED COMPUTING 20DIT057
DEPSTAR (IT) 16
IT442 : ADVANCED COMPUTING 20DIT057
Figure 2.2
DEPSTAR (IT) 17
IT442 : ADVANCED COMPUTING 20DIT057
3. Write a program in cloudsim using NetBeans IDE to create five datacenters with five
host and run cloudlets of five users on them.
Implementation:
/*
* Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
*
* Copyright (c) 2009, The University of Melbourne, Australia
*/
package org.cloudbus.cloudsim.examples;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.CloudletSchedulerTimeShared;
import org.cloudbus.cloudsim.Datacenter;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.DatacenterCharacteristics;
import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Pe;
import org.cloudbus.cloudsim.Storage;
import org.cloudbus.cloudsim.UtilizationModel;
import org.cloudbus.cloudsim.UtilizationModelFull;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.VmAllocationPolicySimple;
import org.cloudbus.cloudsim.VmSchedulerSpaceShared;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.provisioners.BwProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.RamProvisionerSimple;
/**
* A simple example showing how to create
* two datacenters with one host each and
* run cloudlets of two users on them.
*/
public class CloudSimExample5 {
/** The cloudlet lists. */
private static List<Cloudlet> cloudletList1;
private static List<Cloudlet> cloudletList2;
private static List<Cloudlet> cloudletList3;
private static List<Cloudlet> cloudletList4;
private static List<Cloudlet> cloudletList5;
DEPSTAR (IT) 18
IT442 : ADVANCED COMPUTING 20DIT057
DEPSTAR (IT) 19
IT442 : ADVANCED COMPUTING 20DIT057
DEPSTAR (IT) 20
IT442 : ADVANCED COMPUTING 20DIT057
}
catch (Exception e) {
e.printStackTrace();
Log.printLine("The simulation has been terminated due to an
unexpected error");
}
}
private static Datacenter createDatacenter(String name){
// Here are the steps needed to create a PowerDatacenter:
// 1. We need to create a list to store
// our machine
DEPSTAR (IT) 21
IT442 : ADVANCED COMPUTING 20DIT057
DEPSTAR (IT) 22
IT442 : ADVANCED COMPUTING 20DIT057
DEPSTAR (IT) 23
IT442 : ADVANCED COMPUTING 20DIT057
Output:
Figure 2.3
Conclusion:
From this practical, I learned how to simulate the real-world analogy using cloudsim by
modifying the examples of the cloudsim.
DEPSTAR (IT) 24
IT442 : ADVANCED COMPUTING 20DIT057
Practical – 3
DEPSTAR (IT) 25
IT442 : ADVANCED COMPUTING 20DIT057
DEPSTAR (IT) 26
IT442 : ADVANCED COMPUTING 20DIT057
DEPSTAR (IT) 27
IT442 : ADVANCED COMPUTING 20DIT057
}
catch (Exception e) {
e.printStackTrace();
Log.printLine("The simulation has been terminated due to an
unexpected error");
}}
private static Datacenter createDatacenter(String name){
// Here are the steps needed to create a PowerDatacenter:
// 1. We need to create a list to store
// our machine
List<Host> hostList = new ArrayList<Host>();
// 2. A Machine contains one or more PEs or CPUs/Cores.
// In this example, it will have only one core.
List<Pe> peList = new ArrayList<Pe>();
int mips = 1000;
// 3. Create PEs and add these into a list
peList.add(new Pe(0, new PeProvisionerSimple(mips))); // need to store Pe id
and MIPS Rating
//4. Create Host with its id and list of PEs and add them to the list of machines
int hostId=0;
int ram = 2048; //host memory (MB)
long storage = 1000000; //host storage
int bw = 10000;
//in this example, the VMAllocatonPolicy in use is Time Shared with priorities.
It means that VMs
//receive time shares accroding to their priority.
hostList.add(
new Host(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList,
new VmSchedulerTimeShared(peList)
)
); // This is our machine
List<Pe> peList2 = new ArrayList<Pe>();
peList2.add(new Pe(0, new PeProvisionerSimple(mips)));
hostId++;
hostList.add(
new Host(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList2,
DEPSTAR (IT) 28
IT442 : ADVANCED COMPUTING 20DIT057
new VmSchedulerTimeShared(peList2)
)
);
List<Pe> peList3 = new ArrayList<Pe>();
peList3.add(new Pe(0, new PeProvisionerSimple(mips)));
hostId++;
hostList.add(
new Host(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList3,
new VmSchedulerTimeShared(peList3)
) );
// 5. Create a DatacenterCharacteristics object that stores the
// properties of a data center: architecture, OS, list of
// Machines, allocation policy: time- or space-shared, time zone
// and its price (G$/Pe time unit).
String arch = "x86"; // system architecture
String os = "Linux"; // operating system
String vmm = "Xen";
double time_zone = 10.0; // time zone this resource located
double cost = 3.0; // the cost of using processing in this resource
double costPerMem = 0.05; // the cost of using memory in this
resource
double costPerStorage = 0.001; // the cost of using storage in this resource
double costPerBw = 0.0; // the cost of using bw in this
resource
LinkedList<Storage> storageList = new LinkedList<Storage>(); //we are not
adding SAN devices by now
DatacenterCharacteristics characteristics = new DatacenterCharacteristics(
arch, os, vmm, hostList, time_zone, cost, costPerMem,
costPerStorage, costPerBw);
// 6. Finally, we need to create a PowerDatacenter object.
Datacenter datacenter = null;
try {
datacenter = new Datacenter(name, characteristics, new
VmAllocationPolicySimple(hostList), storageList, 0);
} catch (Exception e) {
e.printStackTrace();
}
return datacenter;
}
//We strongly encourage users to develop their own broker policies, to submit vms and
cloudlets according
//to the specific rules of the simulated scenario
private static DatacenterBroker createBroker(){
DatacenterBroker broker = null;
try {
DEPSTAR (IT) 29
IT442 : ADVANCED COMPUTING 20DIT057
DEPSTAR (IT) 30
IT442 : ADVANCED COMPUTING 20DIT057
Output:
Figure 3.1
DEPSTAR (IT) 31
IT442 : ADVANCED COMPUTING 20DIT057
2. Write a program in cloudsim to create two datacenters with one host each and run
cloudlets of three users with network topology on them.
Implementation:
/*
* Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
*
* Copyright (c) 2009, The University of Melbourne, Australia
*/
package org.cloudbus.cloudsim.examples.network;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.CloudletSchedulerTimeShared;
import org.cloudbus.cloudsim.Datacenter;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.DatacenterCharacteristics;
import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.NetworkTopology;
import org.cloudbus.cloudsim.Pe;
import org.cloudbus.cloudsim.Storage;
import org.cloudbus.cloudsim.UtilizationModel;
import org.cloudbus.cloudsim.UtilizationModelFull;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.VmAllocationPolicySimple;
import org.cloudbus.cloudsim.VmSchedulerSpaceShared;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.provisioners.BwProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.RamProvisionerSimple;
/**
* A simple example showing how to create
* two datacenters with one host each and
* run cloudlets of two users with network
* topology on them.
*/
public class NetworkExample3 {
/** The cloudlet list. */
private static List<Cloudlet> cloudletList1;
private static List<Cloudlet> cloudletList2;
private static List<Cloudlet> cloudletList3;
DEPSTAR (IT) 32
IT442 : ADVANCED COMPUTING 20DIT057
DEPSTAR (IT) 33
IT442 : ADVANCED COMPUTING 20DIT057
vmlist1.add(vm1);
vmlist2.add(vm2);
vmlist3.add(vm3);
//submit vm list to the broker
broker1.submitVmList(vmlist1);
broker2.submitVmList(vmlist2);
broker3.submitVmList(vmlist3);
//Fifth step: Create two Cloudlets
cloudletList1 = new ArrayList<Cloudlet>();
cloudletList2 = new ArrayList<Cloudlet>();
cloudletList3 = new ArrayList<Cloudlet>();
//Cloudlet properties
int id = 0;
long length = 40000;
long fileSize = 300;
long outputSize = 300;
UtilizationModel utilizationModel = new UtilizationModelFull();
Cloudlet cloudlet1 = new Cloudlet(id, length, pesNumber, fileSize,
outputSize, utilizationModel, utilizationModel, utilizationModel);
cloudlet1.setUserId(brokerId1);
Cloudlet cloudlet2 = new Cloudlet(id, length, pesNumber, fileSize,
outputSize, utilizationModel, utilizationModel, utilizationModel);
cloudlet2.setUserId(brokerId2);
Cloudlet cloudlet3 = new Cloudlet(id, length, pesNumber, fileSize,
outputSize, utilizationModel, utilizationModel, utilizationModel);
cloudlet3.setUserId(brokerId3);
//add the cloudlets to the lists: each cloudlet belongs to one user
cloudletList1.add(cloudlet1);
cloudletList2.add(cloudlet2);
cloudletList3.add(cloudlet3);
//submit cloudlet list to the brokers
broker1.submitCloudletList(cloudletList1);
broker2.submitCloudletList(cloudletList2);
broker3.submitCloudletList(cloudletList3);
//Sixth step: configure network //load the network topology file
NetworkTopology.buildNetworkTopology("topology.brite");
//maps CloudSim entities to BRITE entities
//Datacenter0 will correspond to BRITE node 0
int briteNode=0;
NetworkTopology.mapNode(datacenter0.getId(),briteNode);
//Datacenter1 will correspond to BRITE node 2
briteNode=2;
NetworkTopology.mapNode(datacenter1.getId(),briteNode);
//Broker1 will correspond to BRITE node 3
briteNode=3;
NetworkTopology.mapNode(broker1.getId(),briteNode);
//Broker2 will correspond to BRITE node 4
briteNode=4;
NetworkTopology.mapNode(broker2.getId(),briteNode);
briteNode=5;
DEPSTAR (IT) 34
IT442 : ADVANCED COMPUTING 20DIT057
NetworkTopology.mapNode(broker3.getId(),briteNode);
// Sixth step: Starts the simulation
CloudSim.startSimulation();
// Final step: Print results when simulation is over
List<Cloudlet> newList1 = broker1.getCloudletReceivedList();
List<Cloudlet> newList2 = broker2.getCloudletReceivedList();
List<Cloudlet> newList3 = broker3.getCloudletReceivedList();
CloudSim.stopSimulation();
Log.print("=============> User "+brokerId1+" ");
printCloudletList(newList1);
Log.print("=============> User "+brokerId2+" ");
printCloudletList(newList2);
Log.print("=============> User "+brokerId3+" ");
printCloudletList(newList3);
Log.printLine("19DIT015 RUSHI DONGA");
}
catch (Exception e) {
e.printStackTrace();
Log.printLine("The simulation has been terminated due to an
unexpected error");
}}
private static Datacenter createDatacenter(String name){
// Here are the steps needed to create a PowerDatacenter:
// 1. We need to create a list to store our machine
List<Host> hostList = new ArrayList<Host>();
// 2. A Machine contains one or more PEs or CPUs/Cores.
// In this example, it will have only one core.
List<Pe> peList = new ArrayList<Pe>();
int mips = 1000;
// 3. Create PEs and add these into a list.
peList.add(new Pe(0, new PeProvisionerSimple(mips))); // need to store Pe id
and MIPS Rating
//4. Create Host with its id and list of PEs and add them to the list of machines
int hostId=0;
int ram = 2048; //host memory (MB)
long storage = 1000000; //host storage
int bw = 10000;
//in this example, the VMAllocatonPolicy in use is SpaceShared. It means that
only one VM
//is allowed to run on each Pe. As each Host has only one Pe, only one VM can
run on each Host.
hostList.add(
new Host(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList,
new VmSchedulerSpaceShared(peList)
)
DEPSTAR (IT) 35
IT442 : ADVANCED COMPUTING 20DIT057
DEPSTAR (IT) 36
IT442 : ADVANCED COMPUTING 20DIT057
Output:
Figure 3.2
Conclusion:
From this practical, I learned how to simulate the real-world analogy of the network topology
using cloudsim by modifying the network examples of the cloudsim.
DEPSTAR (IT) 37
IT442 : ADVANCED COMPUTING 20DIT057
Practical – 4
Implementation:
Step 1: Install cloud Analyst from http://www.cloudbus.org/cloudsim/CloudAnalyst.zip
Step 2: Extract the zip file and then click on run file to run the simulator.
Figure 4.1
Step 3: The Dashboard looks like as shown in the below image.
Figure 4.2
DEPSTAR (IT) 38
IT442 : ADVANCED COMPUTING 20DIT057
Figure 4.3
Figure 4.4
Figure 4.5
DEPSTAR (IT) 39
IT442 : ADVANCED COMPUTING 20DIT057
Figure 4.6
Figure 4.7
DEPSTAR (IT) 40
IT442 : ADVANCED COMPUTING 20DIT057
Figure 4.8
Step 5: Modifying the algorithm.
Configuration of the algorithm:
Figure 4.9
Figure 4.10
DEPSTAR (IT) 41
IT442 : ADVANCED COMPUTING 20DIT057
Figure 4.11
Figure 4.12
Results of the simulation:
Figure 4.13
Conclusion:
From this practical, I learned about the Cloud Analyst. Also learned how to configure the
simulation and run the simulation.
DEPSTAR (IT) 42
IT442 : ADVANCED COMPUTING 20DIT057
PRACTICAL - 5
AIM:
1. To create a webserver using EC2 instance on AWS
2. To host a simple web page over an EC2 instance.
3. Setup AWS with RDS and SQL
IMPLEMENTATION:
PRACTICAL 1:
Step 1: Select Amazon Machine Image (AMI).
Figure 5.1
Figure 5.2
DEPSTAR (IT) 43
IT442 : ADVANCED COMPUTING 20DIT057
Figure 5.3
Figure 5.4
Figure 5.5
DEPSTAR (IT) 44
IT442 : ADVANCED COMPUTING 20DIT057
Figure 5.6
Step 7: Click on Connect at top right corner to connect with your instance.
Figure 5.7
PRACTICAL 2:
Step 1: Run the following commands:
“sudo su”
“yum install httpd”
DEPSTAR (IT) 45
IT442 : ADVANCED COMPUTING 20DIT057
Figure 5.7
Step 2: After completion of the httpd service, enable the service using the following
commands:
“systemctl start httpd”
“systemctl enable httpd”
“systemctl status httpd”
Figure 5.8
Step 3: Copy the public IP of the EC instance and open it in the browser to see a test page
of the apache server which indicates that the server is running.
DEPSTAR (IT) 46
IT442 : ADVANCED COMPUTING 20DIT057
Figure 5.9
Step 4: Run the following command to replace the html with your own custom html on the
webserver:
“echo "<h1>Hello world from $(hostname -f)</h1>" > /var/www/html/index.html”
Refresh the server to see the changes.
Figure 5.10
PRACTICAL 3:
Step 1: Go to the RDS service and enter the Database menu, click on Create Databases.
DEPSTAR (IT) 47
IT442 : ADVANCED COMPUTING 20DIT057
Figure 5.11
Figure 5.12
Figure 5.13
DEPSTAR (IT) 48
IT442 : ADVANCED COMPUTING 20DIT057
Figure 5.13
Step 5: Enter the Master username and password.
Figure 5.14
Step 6: Keep all the other options all default. Click on Create database.
Figure 5.15
DEPSTAR (IT) 49
IT442 : ADVANCED COMPUTING 20DIT057
Figure 5.16
Figure 5.17
CONCLUSION:
In this practical, I have learned about the services of AWS such as AWS EC2 and AWS RDS
DEPSTAR (IT) 50
IT442 : ADVANCED COMPUTING 20DIT057
PRACTICAL-6
AIM:
Create a Static Website and Host it on AWS using S3 bucket.
IMPLEMENTATION:
Step-1: Name the bucket and select the AWS Region for the bucket.
Figure 6.1
Figure 6.2
DEPSTAR (IT) 51
IT442 : ADVANCED COMPUTING 20DIT057
Figure 6.3
Figure 6.4
DEPSTAR (IT) 52
IT442 : ADVANCED COMPUTING 20DIT057
Figure 6.5
Figure 6.6
DEPSTAR (IT) 53
IT442 : ADVANCED COMPUTING 20DIT057
Step-7: Click enable and type the name of the html document of the website.
Finally click Save changes.
Figure 6.7
Step-8: Click on permissions and in the bucket policy section click on Edit and
add the following policy and click Save changes.
{
"Version": "2008-10-17",
"Id": "PolicyForPublicWebsiteContent",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::shreyans-website-bucket/*"
}
DEPSTAR (IT) 54
IT442 : ADVANCED COMPUTING 20DIT057
]}
Figure 6.8
Step-9: Open the link given in the static website hosting section
Figure 6.9
DEPSTAR (IT) 55
IT442 : ADVANCED COMPUTING 20DIT057
Practical – 7
Aim:
1. Create and setup monitoring service for AWS cloud resources and the applications you run
on AWS (Amazon CloudWatch).
Link: https://explore.skillbuilder.aws/learn/course/external/view/elearning/203/introduction-
to-amazon-cloudwatch
2. Create an AWS Identity and Access Management (IAM) group and user, attach a policy
and
add a user to a group.
Link: https://explore.skillbuilder.aws/learn/course/external/view/elearning/120/introduction-
to-aws-identity-and-access-management-iam
Implementation:
Step 1: Select Amazon Machine Image (AMI).
Figure 7.1
Step 2: Choose Instance Type.
DEPSTAR (IT) 56
IT442 : ADVANCED COMPUTING 20DIT057
Figure 7.2
Step 3: Choose your key-pair or create one key pair.
Figure 7.3
Step 4: Set your network settings and choose security group or create one.
Figure 7.4
Step 5: Create another volume.
Figure 7.5
Step 6: Click on Launch Instance.
DEPSTAR (IT) 57
IT442 : ADVANCED COMPUTING 20DIT057
DEPSTAR (IT) 58
IT442 : ADVANCED COMPUTING 20DIT057
Step 7: Click on Connect at top right corner to connect with your instance.
Figure 7.6
1. Create and setup monitoring service for AWS cloud resources and the applications
you run on AWS (Amazon CloudWatch).
Link:https://explore.skillbuilder.aws/learn/course/external/view/elearning/203/
introduction-to-amazon-cloudwatch
Implementation:
Step 1: Click on CloudWatch service by searching on AWS platform.
Step 2: Click on Metrics -> All metrics. Here, you can see all type of metrics.
Figure 7.7
Step 3: Click on Alarms -> All alarms. Here, you can create an alarm or you can perform
required action.
DEPSTAR (IT) 59
IT442 : ADVANCED COMPUTING 20DIT057
Figure 7.8
2. Create an AWS Identity and Access Management (IAM) group and user, attach a
policy and add a user to a group.
Link:https://explore.skillbuilder.aws/learn/course/external/view/elearning/120/
introduction-to-aws-identity-and-access-management-iam
Implementation:
Step 1: Click on IAM -> Access Management -> Users -> Add users. Write the User name.
Select AWS Access type according to requirements.
Figure 7.9
Step 2: Click on Next: Permissions -> Attach existing policies directly. Select which type of
access you want to give to the user.
DEPSTAR (IT) 60
IT442 : ADVANCED COMPUTING 20DIT057
Figure 7.10
Step 3: Click on Next: Tags. You can give the tag to the user. Then, Click on Review. Then,
Click on Create User. Then click on close after downloading the csv file.
Figure 7.11
Step 4: To create the user group, Click on IAM -> Access Management -> User Groups ->
Create Group. Give the name of the group.
Figure 7.12
Step 5: Then, Select the users under the Add users to the group and attach the policies under
the Attach permissions policies according to the requirements.
Figure 7.13
DEPSTAR (IT) 61
IT442 : ADVANCED COMPUTING 20DIT057
Figure 7.14
Conclusion:
In this practical, I have learned about the various services of AWS Cloud Platform like EC2,
CloudWatch, IAM.
DEPSTAR (IT) 62
IT442 : ADVANCED COMPUTING 20DIT057
Practical – 8
Implementation:
To build a Docker image and running a Windows Container:
To get started, let's run the following in our terminal:
$ docker pull alpine
The pull command fetches the alpine image from the Docker registry and saves it in our
system. You can use the docker images command to see a list of all images on your system.
$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
alpine latest c51f86c28340 4 weeks ago 1.109 MB
hello-world latest 690ed74de00f 5 months ago 960 B
Great! Let's now run a Docker container based on this image. To do that you are going to use
the docker run command.
$ docker run alpine ls -l
total 48
drwxr-xr-x 2 root root 4096 Mar 2 16:20 bin
drwxr-xr-x 5 root root 360 Mar 18 09:47 dev
drwxr-xr-x 13 root root 4096 Mar 18 09:47 etc
drwxr-xr-x 2 root root 4096 Mar 2 16:20 home
drwxr-xr-x 5 root root 4096 Mar 2 16:20 lib
......
......
Conclusion:
In this practical, I have learned about building a Docker image and running a Windows
Container.
DEPSTAR (IT) 63
IT442 : ADVANCED COMPUTING 20DIT057
Practical – 9
Theory:
Google Cloud is a suite of cloud services hosted on Google's infrastructure.
From computing and storage, to data analytics, machine learning, and networking,
Google Cloud offers a wide variety of services and APIs that can be integrated with
any cloud-computing application or project, from personal to enterprise-grade.
Features and Components of Google Cloud Platform:
Start Lab (button):
Clicking this button creates a temporary Google Cloud environment, with all the necessary
services and credentials enabled, so you can get hands-on practice with the lab's material.
This also starts a countdown timer.
Credit:
The price of a lab. 1 Credit is usually equivalent to 1 US dollar (discounts are available when
you purchase credits in bulk). Some introductory-level labs (like this one) are free. The more
specialized labs cost more because they involve heavier computing tasks and demand more
Google Cloud resources.
Time:
Specifies the amount of time you have to complete a lab. When you click the Start Lab
button, the timer will count down until it reaches 00:00:00. When it does, your temporary
Google Cloud environment and resources are deleted. Ample time is given to complete a lab,
but make sure you don't work on something else while a lab is running: you risk losing all of
your hard work!
Score:
Many labs include a score. This feature is called "activity tracking" and ensures that you
complete specified steps in a lab. To pass a lab with activity tracking, you need to complete
all the steps in order. Only then will you receive completion credit.
DEPSTAR (IT) 64
IT442 : ADVANCED COMPUTING 20DIT057
Implementation:
Step 1: Sign in to Google Cloud.
Figure 9.1
Step 2: View all projects.
Figure 9.2
Step 3: View your roles and permissions.
DEPSTAR (IT) 65
IT442 : ADVANCED COMPUTING 20DIT057
Figure 9.3
Step 4: View available APIs.
Figure 9.4
Step 5: On the Navigation menu (Navigation menu), click APIs & Services > Library. The
left pane, under the header CATEGORY, displays the different categories available. In the
API search bar, type Dialogflow, and then click Dialogflow API. The Dialogflow description
page opens.
Figure 9.5
Step 6: Click Enable.
DEPSTAR (IT) 66
IT442 : ADVANCED COMPUTING 20DIT057
Figure 9.6
Implementation:
Task 1: Set the default region and zone for all resources
Step 1: In Cloud Shell, set the default zone:
gcloud config set compute/zone us-central1-a
Step 2: Set the default region:
gcloud config set compute/region us-central1
Figure 9.7
DEPSTAR (IT) 67
IT442 : ADVANCED COMPUTING 20DIT057
echo "
<h3>Web Server: www1</h3>" | tee /var/www/html/index.html'
Figure 9.8
Step 2: Create a virtual machine www2 in your default zone.
gcloud compute instances create www2 \
--zone= \
--tags=network-lb-tag \
--machine-type=e2-medium \
--image-family=debian-11 \
--image-project=debian-cloud \
--metadata=startup-script='#!/bin/bash
apt-get update
apt-get install apache2 -y
service apache2 restart
echo "
<h3>Web Server: www2</h3>" | tee /var/www/html/index.html'
Figure 9.9
DEPSTAR (IT) 68
IT442 : ADVANCED COMPUTING 20DIT057
Figure 9.10
Step 4: Create a firewall rule to allow external traffic to the VM instances:
gcloud compute firewall-rules create www-firewall-network-lb \
--target-tags network-lb-tag --allow tcp:80
Figure 9.11
Step 5: Run the following to list your instances. You'll see their IP addresses in the
EXTERNAL_IP column:
gcloud compute instances list
DEPSTAR (IT) 69
IT442 : ADVANCED COMPUTING 20DIT057
Step 6: Verify that each instance is running with curl, replacing [IP_ADDRESS] with the IP
address for each of your VMs:
curl http://[IP_ADDRESS]
Figure 9.12
Step 2: Add a legacy HTTP health check resource:
gcloud compute http-health-checks create basic-check
Figure 9.13
Step 3: Add a target pool in the same region as your instances. Run the following to create
the target pool and use the health check, which is required for the service to function:
gcloud compute target-pools create www-pool \
--region --http-health-check basic-check
Step 4: Add the instances to the pool:
gcloud compute target-pools add-instances www-pool \
--instances www1,www2,www3
Step 5: Add a forwarding rule:
gcloud compute forwarding-rules create www-rule \
--region us-central1 --ports 80 --address network-lb-ip-1 --target-pool www-pool
Figure 9.14
DEPSTAR (IT) 70
IT442 : ADVANCED COMPUTING 20DIT057
Figure 9.15
DEPSTAR (IT) 71
IT442 : ADVANCED COMPUTING 20DIT057
http://169.254.169.254/computeMetadata/v1/instance/name)"
echo "Page served from: $vm_hostname" | \
tee /var/www/html/index.html
systemctl restart apache2'
Figure 9.16
Step 2: Create a managed instance group based on the template:
gcloud compute instance-groups managed create lb-backend-group \
--template=lb-backend-template --size=2 --zone=
Step 3: Create the fw-allow-health-check firewall rule.
gcloud compute firewall-rules create fw-allow-health-check \
--network=default \
--action=allow \
--direction=ingress \
--source-ranges=130.211.0.0/22,35.191.0.0/16 \
--target-tags=allow-health-check \
--rules=tcp:80
Figure 9.17
DEPSTAR (IT) 72
IT442 : ADVANCED COMPUTING 20DIT057
Step 4: Now that the instances are up and running, set up a global static external IP address
that your customers use to reach your load balancer:
gcloud compute addresses create lb-ipv4-1 \
--ip-version=IPV4 \
--global
Figure 9.18
DEPSTAR (IT) 73
IT442 : ADVANCED COMPUTING 20DIT057
Step 8: Create a URL map to route the incoming requests to the default backend service:
gcloud compute url-maps create web-map-http \
--default-service web-backend-service
Step 9: Create a target HTTP proxy to route requests to your URL map:
gcloud compute target-http-proxies create http-lb-proxy \
--url-map web-map-http
Step 10: Create a global forwarding rule to route incoming requests to the proxy:
gcloud compute forwarding-rules create http-content-rule \
--address=lb-ipv4-1\
--global \
--target-http-proxy=http-lb-proxy \
--ports=80
Figure 9.19
Conclusion:
From this practical, I learned about the Google Cloud Platform. Also learned how to enable
APIs in GCP. I also learned about setting up network and HTTP load balancer on GCP.
DEPSTAR (IT) 74
IT442 : ADVANCED COMPUTING 20DIT057
Practical – 10
Implementation:
Task 1: Set a default compute zone
Step 1: Set the default compute region.
gcloud config set compute/region
Step 2: Set the default compute zone.
gcloud config set compute/zone
Figure 10.1
Figure 10.2
Figure 10.3
DEPSTAR (IT) 75
IT442 : ADVANCED COMPUTING 20DIT057
Figure 10.4
Step 4: To view the application from your web browser, open a new tab and enter the
following address, replacing [EXTERNAL IP] with the EXTERNAL-IP for hello-server.
http://[EXTERNAL-IP]:8080
Figure 10.5
Figure 10.6
Conclusion:
From this practical, I learned about performing Cluster orchestration with Google Kubernetes
Engine.
DEPSTAR (IT) 76