CC Lab
CC Lab
Title
Install Google App Engine. Create hello world app and other simple web
applications using Python/Java.
Requirements
Theory
root_directory
|_______templates
| |______index.html
|_______static
|_______main.py
|_______app.yaml
2. The templates directory can be used to store the web templates of the
web application (HTML files).
3. The static directory can be used to store the web static files which
contain the styling and the business logic data for the web application
(CSS and JS files).
4. The main.py is used to define the routes, rendering logic, data
acquisition logic.
5. It provides the WSGI abstraction to the application.
6. The app.yaml file provides the runtime environment, URLs for routes
and launch configuration of the application in the form of key value
pairs.
Steps
Contents of app.yaml
runtime : python2
api_version : 1
threadsafe : true
handlers
- url : /
script : main.app
4. The logic of the application, i.e. the Web server interaction code of the
application must be placed in the main.py file.
5. A simple code displaying the hello world on a web page is as follows
import webapp2
class MainPage(webapp2.RequestHandler) :
def get(self):
self.response.write(“Hello World”)
app = webapp2.WSGIApplication(
[(“/”, MainPage)],
debug=True
)
6. Finally, after saving the above code, the application can be run on the
localhost server using the following command. (The command must be
run on the Google Cloud Shell or the terminal in case of Ubuntu).
Command:
python <path_to_sdk>/bin/devappserver.py
<path_to_application_directory>
Sample Output
1. The application, if no errors are found, is launched on the port 8080 of the
localhost server.
2. The cloud console is visible on port 8000 of the localhost server.
3. The URL of localhost:8080 can be typed in the address bar of the browser
to view the application
4. Screenshots:
a) Application launch at port 8080
Title
Requirements
Theory
root_directory
|_______templates
| |______index.html
| |______results.html
|_______static
|_______main.py
|_______app.yaml
8. The templates directory can be used to store the web templates of the
web application (HTML files).
9. The static directory can be used to store the web static files which
contain the styling and the business logic data for the web application
(CSS and JS files).
10.The main.py is used to define the routes, rendering logic, data
acquisition logic.
11.It provides the WSGI abstraction to the application.
12.The app.yaml file provides the runtime environment, URLs for routes
and launch configuration of the application in the form of key value
pairs.
Steps
Contents of app.yaml
runtime : python2
api_version : 1
threadsafe : true
handlers
url : /
script : main.app
5. The logic of the application, i.e. the Web server interaction code of the
application must be placed in the main.py file.
6. The following python code sends request for information to the API and
interprets response from the API (here, World Time API is used).
import os
import json
import urllib
import webapp2
from google.appengine.ext.webapp import template
class MainPage(webapp2.RequestHandler):
def get(self):
template_values = {}
path = os.path.join(os.path.dirname(__file__), 'templates/index.html')
self.response.out.write(template.render(path, template_values))
def post(self):
region = self.request.get('region')
area = self.request.get('area')
url = "http://worldtimeapi.org/api/timezone/"+ region + "/" + area
data = urllib.urlopen(url).read()
data = json.loads(data)
date = data['datetime'][0:10]
time = data['datetime'][11:19]
week = data['day_of_week']
year = data['day_of_year']
weeknum = data['week_number']
template_values = {
"date": date,
"time": time,
"week": week,
"year": year,
"weeknum": weeknum,
}
path = os.path.join(os.path.dirname(__file__),
'templates/results.html')
self.response.out.write(template.render(path, template_values))
Command:
python <path_to_sdk>/bin/devappserver.py
<path_to_application_directory>
Sample Output
A) The application, if no errors are found, is launched on the port 8080 of the
localhost server.
B) The cloud console is visible on port 8000 of the localhost server.
C) The URL of localhost:8080 can be typed in the address bar of the browser
to view the application
D) Screenshots:
Title
Simulate a cloud scenario using CloudSim and run a scheduling algorithm that is
not present in CloudSim.
Requirements
Theory
A) CloudSim
B) Benefits of CloudSim
C) Architecture
1. CloudSim has a layered architecture which separates the User Code and
the simulation environment.
2. It can be depicted as follows
D) CloudSim Components
E) SJF algorithm
1. SJF stands for Shortest Job First
2. Shortest Job first has the advantage of having a minimum average
waiting time among all scheduling algorithms.
3. It is a Greedy Algorithm.
4. It may cause starvation if shorter processes keep coming. This problem
can be solved using the concept of ageing.
5. It is practically infeasible as Operating System may not know burst
time and therefore may not sort them. While it is not possible to
predict execution time, several methods can be used to estimate the
execution time for a job, such as a weighted average of previous
execution times. SJF can be used in specialized environments where
accurate estimates of running time are available.
Steps
7. Select the Libraries section and click on Add External JARs field on the pop
up
8. Navigate to the jars directory of the CloudSim archive and include the 2 jars
in the project.
9. Create a new package in the src directory of the project.
10.Copy the code files for the constants, Data Center Creator, Data Center
Broker, Matrix Generator and the SJF scheduler files from the
https://github.com/suyash-more/Cloud-Computing-
Projects/tree/master/Scheduling-Algorithm-in-CloudSim/src link.
11.Make sure that the package name provided in each file is the same as the
previously created package.
B) Execution of code
AIM:-. Find a procedure to transfer the files from one virtual machine to another virtual
Machine
Software Tools : VirtualBox
Theory:
Virtualization :
● Virtualization is the process of creating a software-based, or "virtual" version of a
computer, with dedicated amounts of CPU, memory, and storage that are
"borrowed" from a physical host computer—such as your personal computer—
and/or a remote server—such as a server in a cloud provider's datacenter. A virtual
machine is a computer file, typically called an image, that behaves like an actual
computer. It can run in a window as a separate computing environment, often to run
a different operating system—or even to function as the user's entire computer
experience—as is common on many people's work computers. The virtual machine is
partitioned from the rest of the system, meaning that the software inside a VM can't
interfere with the host computer's primary operating system.
Virtual machines: virtual computers within computers
● A virtual machine, commonly shortened to just VM, is no different than any other
physical computer like a laptop, smart phone, or server. It has a CPU, memory, disks
to store your files, and can connect to the internet if needed. While the parts that
make up your computer (called hardware) are physical and tangible, VMs are often
thought of as virtual computers or software-defined computers within physical
servers, existing only as code.
● A virtual machine (VM) is a digital version of a physical computer. Virtual machine
software can run programs and operating systems, store data, connect to networks,
and do other computing functions, and requires maintenance such as updates and
system monitoring. Multiple VMs can be hosted on a single physical machine, often a
server, and then managed using virtual machine software. This provides flexibility for
compute resources (compute, storage, network) to be distributed among VMs as
needed, increasing overall efficiency. This architecture provides the basic building
blocks for the advanced virtualized resources we use today, including cloud
computing. What are virtual machines used for? VMs are the basic building blocks of
virtualized computing resources and play a primary role in creating any application,
tool, or environment—for virtual machines online and on-premises. Here are a few
of the more common enterprise functions of virtual machines: Consolidate servers
VMs can be set up as servers that host other VMs, which lets organizations reduce
sprawl by concentrating more resources onto a single physical machine. Create
development and test environments VMs can serve as isolated environments for
testing and development that include full functionality but have no impact on the
surrounding infrastructure. Support DevOps VMs can easily be turned off or on,
migrated, and adapted, providing maximum flexibility for development
1. Download and install Oracle's Virtual Box. (Reboot needed after installation)
VirtualBox - https://www.virtualbox.org/wiki/Downl...
4. Click on new and mention the Name and the machine folder along with the Type and
Version of the Machine to be created.
5. Assign memory size for our VM (1024 MB sufficient for now).
6. Select the option Use an existing virtual hard disk file and locate the donwloaded
VMDK image below and create VM.
7. Now we have to create a NAT Network so go to File -> Preferences -> Network ->
Add a New NAT Network (Click on +)
8. Right click and edit the Network name and CIDR if needed. Example :
10.Now go to the setting, go to the network setting and change the adapter to NAT
Network and and select the NAT Network you made ( in our case : My VMbox
Network ) and click ok.
$ touch tranfer.txt
$ nano transfer.txt
-> hey, How are you?
ctrl + X and save
Some Commands for Linux Based Distros:
15.If your file is on the VM with IP 172.168.2.4 and the second VM's IP is 172.168.2.5.
17.Check for the file in the Second VM under the /home/vagrant directory.
18.Done..!!!!
Theory:
Virtual Machine:
Virtual machines allow you to run an operating system in an app window on your
desktop that behaves like a full, separate computer. You can use them play around with
different operating systems, run software your main operating system can’t, and try out
apps in a safe, sandboxed environment.
A virtual machine app creates a virtualized environment—called, simply enough, a
virtual machine—that behaves like a separate computer system, complete with virtual
hardware devices. The VM runs as a process in a window on your current operating
system. You can boot an operating system installer disc (or live CD) inside the virtual
machine, and the operating system will be “tricked” into thinking it’s running on a real
computer. It will install and run just as it would on a real, physical machine. Whenever
you want to use the operating system, you can open the virtual machine program and use
it in a window on your current desktop.
In the VM world, the operating system actually running on your computer is called the
host and any operating systems running inside VMs are called guests.
The main purpose of VMs is to operate multiple operating systems at the same time, from
the same piece of hardware.
Advantages of VM:
TryStack:
TryStack is a free and easy way for users to try out OpenStack, and set up their own cloud with
networking, storage, and computer instances.
Requirement:
22
Account on
Steps:
-Specify a Name for your VM. For more information, see Resource naming convention.
-Optional: Change the Zone for this VM. Compute Engine randomizes the list of zones within
each region to encourage use across multiple zones.
23
Select the Custom Images tab.
To select the image project, click Select a project, and then do the following:
24
-The Cloud Console adds a network tag to your VM and creates the corresponding
ingress firewall rule that allows all incoming traffic on tcp:80 (HTTP) or tcp:443
(HTTPS). The network tag associates the firewall rule with the VM. For more
information, see Firewall rules overview in the Virtual Private Cloud documentation. -To
start and create a VM, click Create.
Conclusion :
25
Assignment 6
Title
Objectives
Theory:
Platform as a service (PaaS) It is a cloud computing model where a third-party provider delivers
hardware and software tools to users over the internet. Usually, these tools are needed for
application development. A PaaS provider hosts the hardware and software on its own
infrastructure.
As a public cloud service from a provider, where the consumer controls software
deployment with minimal configuration options, and the provider provides the networks,
servers, storage, operating system (OS), middleware (e.g. Java runtime, .NET runtime,
integration, etc.), database and other services to host the consumer's application.
As a private service (software or appliance) behind a firewall.
As software deployed on public infrastructure as a service
Detailed Steps:-
1. https://www.awseducate.com/registration/s/
26
27
28
Accessing the AWS Management Console
1. At the top of these instructions, choose Start Lab to launch your lab.
2. Wait until you see the message Lab status: ready, then close the Start Lab panel by choosing
the X.
29
3. At the top of these instructions, choose AWS .
This opens the AWS Management Console in a new browser tab. The system will automatically
log you in.
In this task, you launch an EC2 instance with termination protection. Termination protection
prevents you from accidentally terminating an EC2 instance. You deploy your instance with a
user data script in order to deploy a simple web server.
An AMI provides the information required to launch an instance, which is a virtual server in the
cloud. An AMI includes the following:
A template for the root volume for the instance (for example, an operating system or an
application server with applications)
Launch permissions that control which AWS accounts can use the AMI to launch
instances
A block device mapping that specifies the volumes to attach to the instance when it is
launched
The Quick Start list contains the most commonly used AMIs. You can also create your
own AMI or select an AMI from the AWS Marketplace, an online store where you can
sell or buy software that runs on AWS.
1. At the top of the list, choose Select next to Amazon Linux 2 AMI.
30
Step 2: Choose an instance type
Amazon EC2 provides a wide selection of instance types optimized to fit different use cases.
Instance types comprise varying combinations of CPU, memory, storage, and networking
capacity and give you the flexibility to choose the appropriate mix of resources for your
applications. Each instance type includes one or more instance sizes so that you can scale your
resources to the requirements of your target workload.
Select a t2.micro instance This instance type has 1 virtual CPU and 1 GiB of memory.
31
Step 3: Configure instance details
You use this page to configure the instance to suit your requirements. This configuration
includes networking and monitoring settings.
The Network indicates which virtual private cloud (VPC) you want to launch the instance into.
You can have multiple networks, including different ones for development, testing, and
production.
The Lab VPC was created using an AWS CloudFormation template during the setup process of
your lab. This VPC includes two public subnets in two different Availability Zones.
When you no longer require an EC2 instance, you can terminate it, which means that the instance
stops, and Amazon EC2 releases the instance's resources. You cannot restart a terminated
instance. If you want to prevent your users from accidentally terminating the instance, you can
enable termination protection for the instance, which prevents users from terminating instances.
32
When you launch an instance in Amazon EC2, you have the option of passing user data to the
instance that can be used to perform common automated configuration tasks and even run scripts
after the instance starts.
4. Copy the following web application home page sample code into user data filed.
#!/bin/bash
Amazon EC2 stores data on a network-attached virtual disk called Amazon Elastic Block Store
(Amazon EBS).
33
You launch the EC2 instance using a default 8 GiB disk volume. This is your root volume (also
known as a boot volume).
Using tags, you can categorize your AWS resources in different ways (for example, by purpose,
owner, or environment). This categorization is useful when you have many resources of the same
type: you can quickly identify a specific resource based on the tags you have assigned to it. Each
tag consists of a key and a value, both of which you define.
o Key: Name
o Value: Web-Server
Make sure the punctuation for the tags matches exactly as above.
Note: Notice the "Rules with source of 0.0.0.0/0 allow all IP addresses to access your instance.
We recommend setting security group rules to allow access from known IP addresses only."
While this is true and common best practice, this has been simplified for the sake of this lab.
34
Step 6: Configure a security group
A security group acts as a virtual firewall that controls the traffic for one or more instances.
When you launch an instance, you associate one or more security groups with the instance. You
add rules to each security group that allow traffic to or from its associated instances. You can
35
modify the rules for a security group at any time; the new rules are automatically applied to all
instances that are associated with the security group.
In this lab, you do not log in to your instance using SSH. Removing SSH access improves the
security of the instance.
The Review page displays the configuration for the instance that you are about to launch.
1. Choose Launch
A Select an existing key pair or create a new key pair window will appear.
Amazon EC2 uses public–key cryptography to encrypt and decrypt login information. To log in
to your instance, you must create a key pair, specify the name of the key pair when you launch
the instance, and provide the private key when you connect to the instance.
36
In this lab, you do not log in to your instance, so you do not require a key pair.
2. Choose the Choose an existing key pair dropdown list, and select Proceed without a key pair.
3. Select the next to the text I acknowledge that .... 4. Choose Launch Instances
The instance appears in a Pending state, which means it is being launched. It then changes to
Running, which indicates that the instance has started booting. There will be a short time before
you can access the instance.
The instance receives a public DNS name that you can use to contact the instance from the
Internet.
Select the box next to your Web Server. The Details tab displays detailed information about your
instance.
To view more information in the Details tab, drag the window divider upward.
Review the information displayed in the Details, Security and Networking tabs.
37
Task 2: Monitoring your instance
With instance status monitoring, you can quickly determine whether Amazon EC2 has detected
any problems that might prevent your instances from running applications. Amazon EC2
performs automated checks on every running EC2 instance to identify hardware and software
issues.
Notice that both the System reachability and Instance reachability checks have passed.
This tab displays Amazon CloudWatch metrics for your instance. Currently, there are not many
metrics to display because the instance was recently launched.
Amazon EC2 sends metrics to Amazon CloudWatch for your EC2 instances. Basic (5 minute)
monitoring is enabled by default. You can enable detailed (1 minute) monitoring.
38
3. At the top of the page, choose the Actions dropdown menu. Select Monitor and troubleshoot
Get system log.
The system log displays the console output of the instance, which is a valuable tool for problem
diagnosis. It is especially useful for troubleshooting kernel problems and service configuration
issues that could cause an instance to terminate or become unreachable before its SSH daemon
can be started. If you do not see a system log, wait a few minutes and then try again.
1. Scroll through the output, and note that the HTTP package was installed from the user data
that you added when you created the instance.
3. With your web server selected, choose the Actions dropdown menu, and select Monitor and
troubleshoot Get instance screenshot.
This option shows you what your EC2 instance console would look like if a screen were attached
to it. Notice it is essentially a command line interface.
If you are unable to reach your instance via SSH or RDP, you can capture a screenshot of your
instance and view it as an image. This option provides visibility about the status of the instance
and allows for quicker troubleshooting.
Task 3: Updating your security group and accessing the web server
When you launched the EC2 instance, you provided a script that installed a web server and
created a simple web page. In this task, you access content from the web server.
1. Select box next to the EC2 web server you created, and then choose the Details tab.
3. In your web browser, open a new tab, paste the IP address you just copied, and then press
Enter.
Question: Are you able to access your web server? Why not?
You are not currently able to access your web server because the security group is not permitting
inbound traffic on port 80, which is used for HTTP web requests. This is a demonstration of how
to use a security group as a firewall to restrict the network traffic that is allowed in and out of an
instance.
To correct this issue, you now update the security group to permit web traffic on port 80.
4. Keep the browser tab open, but return to the EC2 Management Console tab.
39
6. Select the check box next to the Web Server security group. 7. Choose the Inbound rules tab.
8. Choose Edit inbound rules and then choose Add rule and configure the following:
10. Return to the web server tab that you previously opened, and choose to refresh the page.
You should see the message Hello From Your Web Server!
40
41
42
lOMoAR cPSD| 20576580
Assignment 7
• Problem Definition: Design and develop custom Application (Mini Project) using
Salesforce Cloud.
• Theory:
1. Salesforce:
43
lOMoAR cPSD| 20576580
Step 2: Open Salesforce Lightning platform and click on Object Manager => Create => Custom
Object.
44
lOMoAR cPSD| 20576580
Step 3: Fill in the required fields and under Optional Features, select Allow Reports and Allow
Activities. Click Save.
45
lOMoAR cPSD| 20576580
Step 5: Then select option “Email” and click Next-> Next -> Save.
46
lOMoAR cPSD| 20576580
Step 6: Similarly. Repeat steps 4 and 5 to add more fields like Phone, Date of Birth. This is how
the custom object will have the various fields.
47
lOMoAR cPSD| 20576580
Step 8: Enter the Object name and select any icon for tab style. Leave all defaults as it is. Click
Next, Next, and Save.
Step 9: In Setup, click Home. Enter “App Manager” in Quick Find and select App Manager.
Click New Lightning App.
48
lOMoAR cPSD| 20576580
Step 11: On the App Options screen, leave the defaults as is and click Next. On the Utility Items
screen, leave the defaults as is and click Next. On the Navigation Items screen, select
Student_Detail and move them to the Selected Items box. Then click Next.
49
lOMoAR cPSD| 20576580
Step 12: On the Assign to User Profiles screen, select System Administrator and move it to
Selected Profiles. Then click Save & Finish.
Step 13: Click on App launcher and Open the custom application created.
50
lOMoAR cPSD| 20576580
Step 14: Click on Student_Details => New => fill the specified details and copy the URL.
51
lOMoAR cPSD| 20576580
Step 15: Open Google Chrome new Tab => More Tools => Developer Tools and then paste the
URL of the application, copied in the previous step.
52
lOMoAR cPSD| 20576580
Conclusion: We have learnt to create custom application using salesforce Lightning platform.
53
Assignment 8
Title
Design an Assignment to retrieve, verify, and store user credentials using Firebase
Authentication, the Google App Engine standard environment, and Google Cloud Data store.
Requirements
Theory
A) Firebase:
1. Google Firebase is a mobile application development platform from Google with powerful
features for developing, handling, and enhancing applications. Firebase is a backend platform for
building web and mobile applications.
2. Firebase is fundamentally a collection of tools developers can rely on, creating applications
and expanding them based on demand.
a. Build an app, fast b. Release and monitor an app with confidence c. Engage users,
4. Developers relying on this platform get access to services that they would have to develop
themselves, and it enables them to lay focus on delivering robust application experiences.
5. Some of the Google Firebase platform’s standout features include databases, authentication,
push messages, analytics, file storage, and much more.
6. Since the services are cloud-hosted, developers can smoothly perform ondemand scaling
without any hassle. Firebase is currently among the top app development platforms relied upon
by developers across the globe.
2. Realtime database: Data is synced across all clients in real-time and remains available even
when an app goes offline.
54
3. File Storage: Firebase Storage provides a simple way to save binary files — most often
images, but it could be anything — to Google Cloud Storage directly from the client. Firebase
Storage has it’s own system of security rules to protect your GCloud bucket from the masses,
while granting detailed write privileges to your authenticated clients.
4. Hosting: Firebase Hosting provides fast hosting for a web app; content is cached into content
delivery networks worldwide.
5. Test lab:
Google’s data centers. 6. Notifications: Notifications can be sent with firebase with no additional
coding. Users can get started with firebase for free; more details can be found on the official
website.
C) Firebase Uses:
Steps
1. Initial Setup:
55
c. Login to Firebase:
56
b. You can view the created project in the dashboard:
a. Open the GAE SDK shell and type the command ‘gcloud init’. Then select appropriate
configuration an account:
b. From the list that appears select the appropriate project that we created in
57
4. Adding Firebase to the project:
58
b. In the next window, add the project name that we created in Google Cloud:
59
d. The next window shows some instructions. Read those and click Continue:
60
f. Configure Google Analytics by selecting Default Account for Firebase:
61
5. Adding an App to the Firebase project:
a. From the console, go to your project and click ‘</>’ to add your app:
c. You will receive further configuration details then click Continue to console:
d. You will see the app on the console, click on it to view all its details.
62
63
6. Authentication in Firebase:
64
a. Go to the project’s console and select Authentication:
b. In the Sign-in methods you will see various options, select any one option:
c. Perform appropriate configuration for that platform. You can also add domains:
65
d. Then you can see the added sign-in methods and the domains:
e. Also, when the users login to your application, their details will be visible at the Users tab:
66
a. Go to the backend directory of your application. By using the command ‘pip install -t lib -r
requirements.txt’ install the dependencies:
67
c. Run ‘py dev_appserver.py frontend/app.yaml backend/app.yaml’ to run your application on
localhost
68
8. Deploying your app:
a. Enter ‘gcloud app deploy’ command to deploy your application as shown below:
69
c. The backend and the frontend of your application will be deployed:
70