How to create a Cloud Environment

The basic components of CloudSim are:

  • Step 1: Initialize CloudSim Package.

    CloudSim.init(int numUser,Calender cal, boolean traceflag);

  • Step 2:Create Datacenter.

    Steps to create Datacenter:

    i). We need to create a list to store our machine.</p>

    List hostList = new ArrayList<Host>();

    ii). A Machine contains one or more PEs or CPUs/Cores.

    List<Pe> peList = new ArrayList<Pe>();

    int mips = 1000;

    iii). Create PEs and add these into a list.

    peList.add(new Pe(0, new PeProvisionerSimple(mips)));

    iv). Create Host with its id and list of PEs and add them to the list of machines.

    Host(int id, RamProvisioner ram, BwProvisioner bw, long storage, List<? Extends Pe>peList, VmScheduler vmscheduler);

    v).Create a DatacenterCharacteristics object that stores the properties of a data center.

    // DatacenterCharacteristics(String architecture, String os,String vmm, List<? Extends Host> hostList, double timeZone, double costPerSec, double costPerMem, double costPerStorage, double costPerBw);

    DatacenterCharacteristics obj=new DatacenterCharacteristics(architecture, os, vmm, hostList, timeZone, costPerSec, costPerMem, costPerStorage, costPerBw);

    vi).Finally, we need to create a PowerDatacenter object.

    //Datacenter(String name, DatacenterCharacteristics characteristics, VmAllocationPolicy allocation, List<Storage> storage, double schedulingInterval);

    Datacenter datacenter =new Datacenter(name, characteristics, allocation, storage, schedulingInterval);<strong>

  • Step 3: Create Datacenter Broker. 

    DatacenterBroker(String broker);

  • Step 4: Create one virtual machine. 

    i). Vm(int id, int userid, double mips, int numberOfPes, int ram, long bw, long size, String vmm, CloudletSchedular scheduler);

    ii). Add Vm to the vm list.

    iii). Submit Vm list to the;

  • Step 5: Create one Cloudlet.

    i). //Cloudlet(int cloudletid, long cloudletLength, int pesNumber, long cloudletFileSize, UtilizationModel utilizationModelCPU, UtilizationModel utilizationModelRam, UtilizationModel utilizationModelBw);

    ii). Cloudlet cloud=new Cloudlet(cloudletid, cloudletLength, pesNumber, cloudletFileSize, utilizationModelCPU, utilizationModelRam, utilizationModelBw);

    iii). Add the cloudlet to the list.

    iv). Submit cloudlet list to the broker. broker.submitCloudletList(cloudletList);

  • Step 6: Starts the simulation. 


  • Step 7: Stop the simulation.