Cloud Computing Lab Manual Final
Cloud Computing Lab Manual Final
Cloud Computing Lab Manual Final
1
Cloud Computing Lab
Course Objectives:
I. To inculcate the concepts of distributed computing
II. To familiarize the concepts of cloud computing and services
III. To explain cloud platform and types of cloud
IV. To explain resource management in cloud
Course Outcomes:
1. Demonstrate the benefits of various distributed computing platforms.
2. Use modern tools to built distributed applications.
3. Explain the middleware architectures used in distributing computing
platforms.
4. Analyze various distributed computing architectures with respect to security,
performance and cost.
✔ Intel based desktop PC with minimum of 2.6GHZ or faster processor with at least
256 MB RAM and 40 GB free disk space.
✔ Operating system: Flavor of any WINDOWS
✔ Software: j2sdk1.7
✔ Linux and MySQL
✔ Eclipse or Netbean
2
Introduction To Cloud Computing
Architecture
∙ Public
∙ Private
∙ Community Cloud
∙ Hybrid Cloud
3
LAB CODE
1. Students should report to the concerned lab as per the time table.
2. Students who turn up late to the labs will in no case be permitted to do the
program schedule for the day.
4. Student should bring a notebook of 100 pages and should enter the readings
/observations into the notebook while performing the experiment.
5. The record of observations along with the detailed experimental procedure of the
experiment in the immediate last session should be submitted and certified staff
member in-charge.
6. Not more than 3-students in a group are permitted to perform the experiment on
the set.
7. The group-wise division made in the beginning should be adhered to and no mix
up of students among different groups will be permitted.
9. When the experiment is completed, should disconnect the setup made by them,
and should return all the components/instruments taken for the purpose.
10. Any damage of the equipment or burn-out components will be viewed seriously
either by putting penalty or by dismissing the total group of students from the lab
for the semester/year.
11. Students should be present in the labs for total scheduled duration.
12. Students are required to prepare thoroughly to perform the experiment before
coming to laboratory.
4
INDEX
S.N
Exp.No Name of the Experiment
o
Create a Collaborative learning environment for a particular learning
topic using Google Apps. Google Drive, Google Docs and Google Slides
1 LP1
must be used for hosting e-books, important articles and presentations
respectively
Install Virtual box and create a windows/linux virtual image and analyze
2 LP2
the virtual configuration.
Create Amazon AWS EC2 Linux instance with conceptual understanding
3 LP3
of SSH client software protocol and keys.
Create Amazon AWS EC2 Windows server instance with conceptual
4 LP4
understanding of RDP (Remote Desktop Protocol).
Create cloud storage Bucket using Amazon Simple Storage Service (S3).
Perform the following operations:
5
CLOUD APPLICATION DEVELOPMENT LAB (4-1 SEM -CSE B)
Date: Roll No: 17R21A05B7
Experiment No. 1
THEORY:
Google Docs is a free cloud-based suite of tools for creating documents, spreadsheets,
presentations, and more. This tutorial will cover the Spreadsheets application in Google
Docs, in addition to showing you how to access and store your Docs from Google Drive.
Google Docs, Sheets, and Slides are productivity apps that let you create different kinds
of online documents, work on them in real time with other people, and store them in your
Google Drive online — all for free. You can access the documents, spreadsheets, and
presentations you create from any computer, anywhere in the world. (There's even some
work you can do without an Internet connection!) This guide will give you a quick
overview of the many things that you can do with Google Docs, Sheets, and Slides.
Google Docs
Google Docs is an online word processor that lets you create and format text documents
and collaborate with other people in real time. Here's what you can do with Google Docs:
Google Sheets
Google Sheets is an online spreadsheet app that lets you create and format spreadsheets
and simultaneously work with other people. Here's what you can do with Google Sheets:
6
● Import and convert Excel, .csv, .txt and .ods formatted data to a Google
spreadsheet
● Export Excel, .csv, .txt and .ods formatted data, as well as PDF and HTML files
● Use formula editing to perform calculations on your data, and use formatting
make it look the way you'd like
● Chat in real time with others who are editing your spreadsheet
● Create charts with your data
● Embed a spreadsheet — or individual sheets of your spreadsheet — on your blog
or website
Google Slides
Google Slides is an online presentations app that allows you to show off your work in a
visual way. Here's what you can do with Google Slides:
7
Create and save a document
There are different ways of getting started using Google documents: you can create a new
online document, you can upload an existing one, or you can use a template from our
templates gallery.
To create a new document, go to your Drive, click the red Create button, and select
Document from the drop-down menu.
As soon as you name the document or start typing, Google Docs will automatically save
your work every few seconds. At the top of the document, you'll see text that indicates
when your document was last saved. You can access your document at any time by
opening your Drive at http://drive.google.com.
To save a copy of a document to your computer, you can download it. In your document,
go to the File menu and point your mouse to the Download as option. Select one of the
following file types: HTML (zipped), RTF, Word, Open Office, PDF, and plain text.
Your document will download to your computer.
Upload a document
You can upload existing documents to Google documents at any time. When you're
uploading, you can either keep your document in its original file type or convert it to
Google Docs format. Converting your document to Google Docs format allows you to
edit and collaborate online from any computer.
Note: When uploaded, images within a document are left as images (rather than being
converted to text by Optical Character Recognition technology).
You can upload the following file types:
● .html
● .txt
● .odt
● .rtf
● .doc and .docx
● .pdf
1. Click the Upload icon in the top left of your Documents List.
2. Click Files..., and select the document you'd like to upload.
3. Click Open.
4. Check the box next to 'Convert documents, presentations, spreadsheets, and
drawings to the corresponding Google Docs format' if you'd like to be able to edit
and collaborate on the document online. Uploaded document files that are
converted to Google documents format can't be larger than 1 MB.
5. Click Start upload. The uploaded file will appear in your Documents List.
8
9
CLOUD APPLICATION DEVELOPMENT LAB (4-1 SEM -CSE B)
Date: Roll No: 17R21A05B7
Experiment No. 2
Objective: Install Virtual box and VMWare and create a windows/linux virtual
image and analyze the virtual configuration
Requirement: Internet
THEORY:
VirtualBox is an open-source hypervisor software; it allows you to create and run guest
operating systems (“virtual machines”) such as Linux and Windows on top of the existing
operating system (host). VirtualBox may be installed on host operating systems,
including Linux, Windows, Solaris, OS X, and OpenSolaris.
virtualbox.org install VM
10
After installation, you can start VirtualBox as follows:
On a Windows host, in the standard "Programs" menu, click on the item in the
"VirtualBox" group. On Vista or Windows 7, you can also type "VirtualBox" in the
search box of the "Start" menu.
Click on the "New" button at the top of the VirtualBox Manager window. A wizard will
pop up to guide you through setting up a new virtual machine (VM)
● The VM name will later be shown in the VM list of the VirtualBox Manager
window,∙ and it will be used for the VM's files on disk. Even
though any name could be used, keep in mind that once you
have created a few VMs, you will appreciate if you have
given your VMs rather informative names; "My VM" would
thus be less useful than "Windows XP SP2 with OpenOffice".
11
● On the next page, select the memory (RAM) that Virtual Box should allocate
every time the virtual machine is started. The amount of memory given here will
be taken away from your host machine and presented to the guest operating
system, which will report this size as the (virtual) computer's installed RAM.
A Windows XP guest will require at least a few hundred MB RAM to run properly, and
Windows Vista will even refuse to install with less than 512 MB. Of course, if you want
to run graphics-intensive applications in your VM, you may require even more RAM.
So, as a rule of thumb, if you have 1 GB of RAM or more in your host computer, it is
usually safe to allocate 512 MB to each VM. But, in any case, make sure you always
have at least 256 to 512 MB of RAM left on your host operating system. Otherwise you
may cause your host OS to excessively swap out memory to your hard disk, effectively
bringing your host system to a standstill. As with the other settings, you can change this
setting later, after you have created the VM.
12
● Next, you must specify a virtual hard disk for your VM. There are many and
potentially complicated ways in which VirtualBox can provide hard disk space to
a VM (see Chapter 5, Virtual storage for details), but the most common way is to
use a large image file on your "real" hard disk, whose contents VirtualBox
presents to your VM as if it were a complete hard disk. This file represents an
entire hard disk then, so you can even copy it to another host and use it with
another VirtualBox installation
13
Running your virtual machine: To start a virtual machine, you have several options
select its entry in the list in the Manager window it and press the "Start" button at the top
for virtual machines created with VirtualBox 4.0 or later, navigate to the "VirtualBox
VMs" folder in your system user's home directory, find the subdirectory of the machine
you want to start and double-click on the machine settings file (with a .vbox file
extension). This opens up a new window, and the virtual machine which you selected will
boot up. Everything which would normally be seen on the virtual system's monitor is
shown in the window. In general, you can use the virtual machine much like you would
use a real computer. There are couple of points worth mentioning however.
Saving the state of the machine: When you click on the "Close" button of your virtual
machine window (at the top right of the window, just like you would close any other
window on your system), VirtualBox asks you whether you want to "save" or "power off"
the VM. (As a shortcut, you can also press the Host key together with "Q".)
14
15
CLOUD APPLICATION DEVELOPMENT LAB (4-1 SEM -CSE B)
Date: Roll No: 17R21A05B7
Experiment No. 3
Objective: Create Amazon AWS EC2 Linux instance with conceptual understanding of
SSH client software protocol and keys.
Requirement: Internet
Step 1: Choose an AMI (Amazon machine image) for the instance you want: this can be
single CPU machine to a sophisticated cluster of powerful processors.
The instances can be from Amazon Market Place, Community (contributed) AMI, My
own AMIs (that I may have created: Eg.,RichsAMI) Choose a “free-tier” eligible
Windows AMI.
Step 2: Choose an instance type: small, large, micro, medium , etc.
Step 3: Review and launch. We are done, we have Windows machine.
Step 4: Create a new key-pair to access the instance that will be created. We will be
accessing the instance we create using Public-private key pair. Download the pair of the
key and store it.
16
Launch instance. Once it is ready you will use its public IP and the key pair we saved
and the RDP protocol to access the instance on the cloud.
Step 2: Enable logging and redirection (note: for some reason this collides with
richs.com)
1. In the logging window enter logs.richs.com and /root in the next box; right click
on www.richs.com properties and redirect it to richs.com
2. In the richs.com bucket, enable web hosting and enter index,html as the index
document. If you an error document, you can ad that in the next box.
3. Click on the endpoint address that shows up in properties window of richs.com
4. You should be able to see the static application.
17
CLOUD APPLICATION DEVELOPMENT LAB (4-1 SEM -CSE B)
Date: Roll No: 17R21A05B7
Experiment No. 4
Objective: Create Amazon AWS EC2 Windows server instance with conceptual
understanding of RDP (Remote Desktop Protocol).
Requirement: Internet
● Login to your AWS account and go to the AWS Services tab at the top left corner.
● Here, you will see all of the AWS Services categorized as per their area viz.
Compute, Storage, Database, etc. For creating an EC2 instance, we have to
choose Computeà EC2 as in the next step.
● Open all the services and click on EC2 under Compute services. This will launch
the dashboard of EC2.
18
Here is the EC2 dashboard. Here you will get all the information in gist about the AWS
EC2 resources running.
Step 2: On the top right corner of the EC2 dashboard, choose the AWS Region in which
you want to provision the EC2 server.
Here we are selecting N. Virginia. AWS provides 10 Regions all over the globe.
● Once your desired Region is selected, come back to the EC2 Dashboard.
● Click on 'Launch Instance' button in the section of Create Instance (as shown
below).
19
Choose AMI
Step 4: In this step we will do,
1. You will be asked to choose an AMI of your choice. (An AMI is an Amazon
Machine Image. It is a template basically of an Operating System platform which
you can use as a base to create your instance). Once you launch an EC2 instance
from your preferred AMI, the instance will automatically be booted with the
desired OS. (We will see more about AMIs in the coming part of the tutorial).
2. Here we are choosing the default Amazon Linux (64 bit) AMI.
1. We will choose t2.micro instance type, which is a 1vCPU and 1GB memory
server offered by AWS.
2. Click on "Configure Instance Details" for further configurations
20
● In the next step of the wizard, enter details like no. of instances you want to
launch at a time.
● Here we are launching one instance.
Step 6: In the next step you will be asked to create a key pair to login to you an instance.
A key pair is a set of public-private keys.
AWS stores the private key in the instance, and you are asked to download the public
key. Make sure you download the key and keep it safe and secured; if it is lost you cannot
download it again.
● When you download your key, you can open and have a look at your RSA private
key.
21
Step 7: Once you are done downloading and saving your key, launch your instance.
● Click on the 'Instances' option on the left pane where you can see the status of the
instance as 'Pending' for a brief while.
● Click on the 'Instances' option on the left pane where you can see the status of the
instance as 'Pending' for a brief while.
22
● Once your instance is up and running, you can see its status as 'Running' now.
● Note that the instance has received a Private IP from the pool of AWS.
In this tutorial, you will learn how to launch, configure, and connect to a
Windows Virtual Machine using Amazon Elastic Compute Cloud (EC2).
Amazon EC2 is the Amazon Web Service you use to create and run virtual
machines in the cloud (we call these virtual machines 'instances'). Everything
done in this tutorial is free tier eligible.
23
Step 8: Create and Configure Your Virtual Machine
a. You are now in the Amazon EC2 console. Click Launch Instance
24
With Amazon EC2, you can specify the software and specifications of the instance you
want to use. In this screen, you are shown options to choose an Amazon Machine Image
(AMI), which is a template that contains the software configuration required to launch
your instance.
For this tutorial, find Microsoft Windows Server 2012 R2 Base and click Select.
25
You will now choose an instance type. Instance types comprise of varying combinations
of CPU, memory, storage, and networking capacity so you can choose the appropriate
mix for your applications. For more information, see Amazon EC2 Instance Types.
For this tutotiral, selct the default option of t2.micro - this instance type is covered within
the free tier. Then click Review and Launch at the bottom of the page.
26
You can review the options that are selected for your instance which include AMI
Details, Instance Type, Security Groups, Instance Details, Storage, and Tags. You can
leave these at the defaults and click Launch from the bottom of the page.
Note: For detailed information on your options, see Launching an Instance
a. In the popover, select Create a new key pair and name it MyFirstKey. Then
click Download Key Pair. MyFirstKey.pem will be downloaded to your computer --
make sure to save this key pair in a safe location on your computer.
● Windows users: We recommend saving your key pair in your user directory in a sub-
directory called .ssh (ex.C:\user\{yourusername}\.ssh\MyFirstKey.pem).
● Mac/Linux users: We recommend saving your key pair in the .ssh sub-directory from
your home directory (ex.~/.ssh/MyFirstKey.pem).
Note: If you don't remember where you store your SSH private key (the file you are
downloading), you won't be able to connect to your virtual machine.
27
b. After you have downloaded and saved your key pair, click Launch Instance to start
your Windows Server instance.
Note: It can take a few minutes to launch your instance.
On the next screen, click View Instances to view the instance you have just
created and see its status.
28
Step 10: Connect to Your Instance
After launching your instance, it's time to retrieve the administrator password and
connect to it using a Remote Desktop Protocol (RDP) client.
AWS documentation includes information on how to install a RDP client if you need
one.
a. Select the Windows Server instance you just created and click Connect
29
b. In order to connect to your Windows virtual machine instance, you will need a user
name and password:
. In order to retrieve the password, you will need to locate the Key Pair you
created in Step 3. Click Choose File and browse to the directory you
30
stored MyFirstKey.pem. Your Key Pair will surface in the text box.
Click Decrypt Password.
You now have a decrypted password for your Windows Server instance. Make
sure to save this information in a secure location. It is your Windows Server
admin login credentials.
31
When prompted log in to the instance, use the User Name and Password you generated in
to connect to your virtual machine.
Note: When you complete this step, you might get a warning that the security
certificate could not be authenticated. Simply choose yes and proceed to complete
the connection to your Windows Server instance
32
Back on the EC2 Console, select the box next to the instance you created. Then click
the Actions button, navigate to Instante State, and click Terminate.
33
CLOUD APPLICATION DEVELOPMENT LAB (4-1 SEM -CSE B)
Date: Roll No: 17R21A05B7
Experiment No. 5
Objective: Create cloud storage Bucket using Amazon Simple Storage Service (S3).
Perform the following operations:
a. Create a folder within a S3 Bucket
b. Upload content to S3
c. Change permissions to allow public access of contents.
d. Set Meta Data on an S3 Bucket
e. Delete an S3 Bucket and its content.
Requirement: Internet
THEORY: Before you can upload data to Amazon S3, you must create a bucket in one
of the AWS Regions to store your data in. After you create a bucket, you can upload an
unlimited number of data objects to the bucket.
A bucket is owned by the AWS account that created it. By default, you can create up to
100 buckets in each of your AWS accounts. If you need additional buckets, you can
increase your account bucket limit to a maximum of 1,000 buckets by submitting a
service limit increase. For information about how to increase your bucket limit, see AWS
Service Limits in the AWS General Reference.
Buckets have configuration properties, including their geographical region, who has
access to the objects in the bucket, and other metadata.
a. To create an S3 bucket
1. Sign in to the AWS Management Console and open the Amazon S3 console at
https://console.aws.amazon.com/s3/.
2. Choose Create bucket.
3. On the Name and region page, type a name for your bucket and choose the AWS
Region where you want the bucket to reside. Complete the fields on this page as
follows:
34
a. For Bucket name, type a unique DNS-compliant name for your new
bucket. Follow these naming guidelines:
4.
a. The name must be unique across all existing bucket names in Amazon S3.
b. The name must not contain uppercase characters.
c. The name must start with a lowercase letter or number.
d. The name must be between 3 and 63 characters long.
e. After you create the bucket you cannot change the name, so choose
wisely.
f. Choose a bucket name that reflects the objects in the bucket because the
bucket name is visible in the URL that points to the objects that you're
going to put in your bucket.
5. For Region, choose the AWS Region where you want the bucket to reside.
Choose a Region close to you to minimize latency and costs, or to address
regulatory requirements. Objects stored in a Region never leave that Region
unless you explicitly transfer them to another Region. For a list of Amazon S3
AWS Regions, see Regions and Endpoints in the Amazon Web Services General
Reference.
6. (Optional) If you have already set up a bucket that has the same settings that you
want to use for the new bucket that you want to create, you can set it up quickly
by choosing Copy settings from an existing bucket, and then choosing the
bucket whose settings
7. you want to copy.
The settings for the following bucket properties are copied: versioning, tags, and
logging.
35
On the Configure options page, you can configure the following properties and Amazon
Cloud Watch metrics for the bucket. Or, you can configure these properties and Cloud
Watch metrics later, after you create the bucket.
a. Versioning
Select Log requests for access to your bucket. to enable server access logging
on the bucket. Server access logging provides detailed records for the requests
that are made to your bucket. For more information about enabling server access
logging.
36
B: Upload content to S3
If you are using the Chrome or Firefox browsers, you can choose the folders and files to
upload, and then drag and drop them into the destination bucket. Dragging and dropping
is the only way that you can upload folders.
1. Sign in to the AWS Management Console and open the Amazon S3 console at
https://console.aws.amazon.com/s3/.
2. In the Bucket name list, choose the name of the bucket that you want to upload
your folders or files to.
3. In a window other than the console window, select the files and folders that you
want to upload. Then drag and drop your selections into the console window that
lists the objects in the destination bucket.
37
In the Upload dialog box, do one of the following:
a. Drag and drop more files and folders to the console window that displays the
Upload dialog box. To add more files, you can also choose Add more files. This
option works only for files, not folders.
b. To immediately upload the listed files and folders without granting or removing
permissions for specific users or setting public permissions for all of the files that
you're uploading, choose Upload. For information about object access
permissions,.
To set permissions or properties for the files that you are uploading, choose Next.
38
On the Set Permissions page, under Manage users you can change the permissions for
the AWS account owner. The owner refers to the AWS account root user, and not an
AWS Identity and Access Management (IAM) user. For more information about the root
user, see The AWS Account Root User.
Choose Add account to grant access to another AWS account. For more information
about granting permissions to another AWS account, see How Do I Set ACL Bucket
Permissions?.
Under Manage public permissions you can grant read access to your objects to the
general public (everyone in the world), for all of the files that you're uploading. Granting
public read access is applicable to a small subset of use cases such as when buckets are
used for websites. We recommend that you do not change the default setting of Do not
grant public read access to this object(s). You can always make changes to object
permissions after you upload the object. For information about object access permissions,
You can configure some system metadata for an S3 object. For a list of system-defined
metadata and whether you can modify their values, see System-Defined Metadata in the
Amazon Simple Storage Service Developer Guide.
1. Sign in to the AWS Management Console and open the Amazon S3 console at
https://console.aws.amazon.com/s3/.
2. In the Bucket name list, choose the name of the bucket that contains the object.
3. In the Name list, choose the name of the object that you want to add metadata to.
39
4. Choose Properties, and then choose Metadata.
5. Choose Add Metadata, and then choose a key from the Select a key menu.
40
6. Depending on which key you chose, choose a value from the Select a value menu
or type a value.
41
7. Choose Save.
42
E: To delete an S3 bucket
1. Sign in to the AWS Management Console and open the Amazon S3 console
athttps://console.aws.amazon.com/s3/.
2. In the Bucket name list, choose the bucket icon next to the name of the bucket
that you want to delete and then choose Delete bucket.
In the Delete bucket dialog box, type the name of the bucket that you want to delete for
confirmation, and then choose Confirm.
Note
The text in the dialog box changes depending on whether the bucket is empty, is used for
a static website, or is used for ELB access logs.
43
44
CLOUD APPLICATION DEVELOPMENT LAB (4-1 SEM -CSE B)
Date: Roll No: 17R21A05B7
Experiment No. 6
Objective: Launch and connect to an Amazon Relational Data Base (RDS) Service , Use
any one from MySQL, Oracle, SQL Server and post greSQL DataBase engines .
Requirement: Internet
THEORY: Launch and connect to an Amazon Relational Data Base (RDS) Service ,
Use any one from MySQL, Oracle, SQL Server and post greSQL DataBase engines.
After you create an Amazon RDS DB instance, you can use any standard SQL client
application to connect to the DB instance. To connect to an Amazon RDS DB instance,
follow the instructions for your specific database engine.
Before you can connect to a DB instance running the MySQL database engine, you must
create a DB instance. For information, see Creating a DB Instance Running the MySQL
Database Engine. Once Amazon RDS provisions your DB instance, you can use any
standard MySQL client application or utility to connect to the instance. In the connection
string, you specify the DNS address from the DB instance endpoint as the host parameter,
and specify the port number from the DB instance endpoint as the port parameter.
To authenticate to your RDS DB instance, you can use one of the authentication methods
for MySQL and IAM database authentication.
To find the endpoint for a MySQL DB instance in the AWS Management Console:
1. Open the RDS console and then choose Databases to display a list of your DB
instances.
2. Choose the MySQL DB instance name to display its details.
45
3. On the Connectivity tab, copy the endpoint. Also, note the port number. You
need both the endpoint and the port number to connect to the DB instance.
You can connect to an Amazon RDS MySQL DB instance by using tools like the
MySQL command line utility. For more information on using the MySQL client, go
to mysql - The MySQL Command Line Tool in the MySQL documentation. One GUI-
based application you can use to connect is MySQL Workbench. For more information,
go to the Download MySQL Workbench page. For information about installing MySQL
(including the MySQL client), see Installing and Upgrading MySQL.
46
● The DB instance was created using a security group that does not authorize
connections from the device or Amazon EC2 instance where the MySQL
application or utility is running. If the DB instance was created in a VPC, it must
have a VPC security group that authorizes the connections. If the DB instance was
created outside of a VPC, it must have a DB security group that authorizes the
connections. For more information, see Amazon Virtual Private Cloud (VPCs)
and Amazon RDS.
● The DB instance was created using the default port of 3306, and your company
has firewall rules blocking connections to that port from devices in your company
network. To fix this failure, recreate the instance with a different port.
You can use SSL encryption on connections to an Amazon RDS MySQL DB instance.
For information, see Using SSL with a MySQL DB Instance. If you are using IAM
database authentication, you must use an SSL connection. For information, see IAM
Database Authentication for MySQL and PostgreSQL.
To connect to a DB instance using the MySQL client, type the following command at a
command prompt to connect to a DB instance using the MySQL client. For the -h
parameter, substitute the DNS name (endpoint) for your DB instance. For the -P
parameter, substitute the port for your DB instance. Enter the master user password when
prompted.
After you enter the password for the user, you will see output similar to the following.
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
Amazon RDS creates an SSL certificate for your DB instance when the instance is
created. If you enable SSL certificate verification, then the SSL certificate includes the
DB instance endpoint as the Common Name (CN) for the SSL certificate to guard against
spoofing attacks. To connect to your DB instance using SSL, you can use native
password authentication or IAM database authentication. To connect to your DB instance
using IAM database authentication, see IAM Database Authentication for MySQL and
47
PostgreSQL. To connect to your DB instance using native password authentication, you
can follow these steps:
3. You can require that the SSL connection verifies the DB instance endpoint against
the
4. endpoint in the SSL certificate.
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
48
1. From Database, choose Manage Connections.
2. In the Manage Server Connections window, choose New.
3. In the Connect to Database window, enter the following information:
● Stored Connection – Enter a name for the connection, such as MyDB.
● Hostname – Enter the DB instance endpoint.
● Port – Enter the port used by the DB instance.
● Username – Enter the username of a valid database user, such as the
master user.
● Password – Optionally, choose Store in Vault and then enter and save
the password for the user.
49
1. Optionally, choose Test Connection to confirm that the connection to the DB
instance is successful.
2. Choose Close.
3. From Database, choose Connect to Database.
4. From Stored Connection, choose your connection.
5. Choose OK.
The connection limit for a DB instance is set by default to the maximum for the DB
instance class for the DB instance. You can limit the number of concurrent connections to
any value up to the maximum number of connections allowed using
the max_connections parameter in the parameter group for the DB instance. For more
information, see Working with DB Parameter Groups.
You can retrieve the maximum number of connections allowed for an Amazon RDS
MySQL DB instance by executing the following query on your DB instance:
50
SELECT @@max_connections;
You can retrieve the number of active connections to an Amazon RDS MySQL DB
instance by executing the following query on your DB instance:
51
CLOUD APPLICATION DEVELOPMENT LAB (4-1 SEM -CSE B)
Date: Roll No: 17R21A05B7
Experiment No. 7
Objective: Develop and host a website in Amazon AWS Server (windows/Linux) that
you have created in experiment 3 or 4
Requirement: Internet
52
● example.com
● www.example.com
Note
Like domains, sub domains must have their own S3 buckets, and the buckets must share
the exact names as the sub domains. In this example, we are creating the
www.example.com sub domain, so we also need an S3 bucket named
www.example.com.
To create your buckets and upload your website content for hosting
1. Sign in to the AWS Management Console and open the Amazon S3 console at
https://console.aws.amazon.com/s3/.
2. Create two buckets that match your domain name and subdomain. For instance,
example.com and www.example.com.
For step-by-step instructions, in the Amazon Simple Storage Service Console User Guide.
3. Upload your website data to the example.com bucket.
You will host your content out of the root domain bucket (example.com), and you will
redirect requests for www.example.com to the root domain bucket. You can store content
in either bucket. For this example, you host content in the example.com bucket. The
content can be text files, family photos, videos—whatever you want. If you have not yet
created a website, then you only need one file for this example. You can upload any file.
For example, you can create a file using the following HTML and upload it to the bucket.
The file name of the home page of a website is typically index.html, but you can give it
any name. In a later step, you provide this file name as the index document name for your
website.
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>My Website Home Page</title>
</head>
<body>
<h1>Welcome to my website</h1>
<p>Now hosted on Amazon S3!</p>
</body>
</html>
To host a website, your bucket must have public read access. It is intentional that
everyone in the world will have read access to this bucket. To grant public read access,
attach the following bucket policy to the example.com bucket, substituting the name of
your bucket for example.com. For step-by-step instructions to attach a bucket policy.
{
"Version":"2012-10-17",
"Statement":[{
"Sid":"PublicReadGetObject",
"Effect":"Allow",
"Principal": "*",
"Action":["s3:GetObject"],
"Resource":["arn:aws:s3:::example.com/*"]
}]
}
1. You now have two buckets, example.com and www.example.com, and you have
uploaded your website content to the example.com bucket. In the next step, you
53
configure www.example.com to redirect requests to your example.com bucket. By
redirecting requests, you can maintain only one copy of your website content.
Visitors who type www in their browsers and those who specify only the root
domain are routed to the same website content in your example.com bucket.
54
6. Choose Save.
Now that you have configured your bucket for website hosting, configure the
www.example.com bucket to redirect all requests for www.example.com to example.com.
55
Step 2.4: Configure Logging for Website Traffic
Optionally, you can configure logging to track the number of visitors accessing
your website. To do that, you enable logging for the root domain bucket.
To test the website, type the URL of the endpoint in your browser. Your request is
redirected, and the browser displays the index document for example.com.
In the next step, you use Amazon Route 53 to enable customers to use all of the
URLs to navigate to your site.
In this step, you create the alias records that you add to the hosted zone for your
domain maps example.com and www.example.com to the corresponding S3
buckets. Instead of using IP addresses, the alias records use the Amazon S3
website endpoints. Amazon Route 53 maintains a mapping between the alias
records and the IP addresses where the Amazon S3 buckets reside.
To route traffic to your website
1. Open the Route 53 console at https://console.aws.amazon.com/route53/.
Note
If you don’t already use Amazon Route 53, you can get started here. After you
have completed your set up, you can resume the instructions below.
2. In the list of hosted zones, choose the name of your domain.
56
3. Choose Create Record Set.
Note
Each record contains information about how you want to route traffic for one
domain (example.com) or subdomain (www.example.com). Records are stored in
the hosted zone for your domain.
4. Specify the following values:
Name
For the first record that you'll create, accept the default value, which is the name of your
hosted zone and your domain. This will route internet traffic to the bucket that has the
same name as your domain.
Repeat this step to create a second record for your subdomain. For the second record,
type www. This will route internet traffic to the www.example.com bucket.
Type
Choose A – IPv4 address.
Alias
Choose Yes.
Alias Target
Type the name of your Amazon S3 bucket endpoint, for example example.com (s3-
website-us-west-2).
Note
You specify the same value for Alias Target for both records. Route 53 figures
out which bucket to route traffic to based on the name of the record.
Routing Policy
Accept the default value of Simple.
Evaluate Target Health
Accept the default value of No.
5. Choose Create.
6. For www.example.com, repeat steps 3 through 5 to create a record.
The following screenshot shows the alias record for example.com as an
illustration. You also need to create an alias record for www.example.com.
Step 4: Testing
57
To verify that the website is working correctly, in your browser, try the following URLs:
● http://example.com – Displays the index document in the example.com bucket.
● http://www.example.com – Redirects your request to http://example.com.
In some cases, you might need to clear the cache of your web browser to see the expected
behaviour.
58
CLOUD APPLICATION DEVELOPMENT LAB (4-1 SEM -CSE B)
Date: Roll No: 17R21A05B7
Experiment No. 8
Objective: DNS setup in the Route53 in Amazon AWS for a specific domain.
Requirement: Internet
THEORY:
You can use Amazon Route 53 as the DNS service for your domain, such as
example.com. When Route 53 is your DNS service, it routes internet traffic to your
website by translating friendly domain names like www.example.com into numeric IP
addresses, like 192.0.2.1, that computers use to connect to each other. When someone
types your domain name in a browser or sends you an email, a DNS query is forwarded
to Route 53, which responds with the appropriate value. For example, Route 53 might
respond with the IP address for the web server for example.com.
In this chapter, we explain how to configure Route 53 to route your internet traffic to the
right places. We also explain how to migrate DNS service to Route 53 if you're currently
using another DNS service, and how to use Route 53 as the DNS service for a new
domain.
When you register a domain with Route 53, we automatically make Route 53 the DNS
service for the domain. Route 53 creates a hosted zone that has the same name as the
domain, assigns four name servers to the hosted zone, and updates the domain to use
those name servers.
To specify how you want Route 53 to route internet traffic for the domain, you create
records in the hosted zone. For example, if you want to route requests for example.com to
a web server that's running on an Amazon EC2 instance, you create a record in the
example.com hosted zone, and you specify the Elastic IP address for the EC2 instance.
For more information, see the following topics:
When you register a domain with Route 53, we automatically make Route 53 the DNS
service for the domain. Route 53 creates a hosted zone that has the same name as the
domain, assigns four name servers to the hosted zone, and updates the domain to use
those name servers.
To specify how you want Route 53 to route internet traffic for the domain, you create
records in the hosted zone. For example, if you want to route requests for example.com to
59
a web server that's running on an Amazon EC2 instance, you create a record in the
example.com hosted zone, and you specify the Elastic IP address for the EC2 instance.
60
CLOUD APPLICATION DEVELOPMENT LAB (4-1 SEM -CSE B)
Date: Roll No: 17R21A05B7
Experiment No. 9
Objective: Connect to the server using any FTP Client (Ex: FileZilla) and update the
website content.
Requirement: Internet
THEORY:
Before you can login with SFTP, you need to activate SFTP or SSH access in your
One.com control panel.
1. Open FileZilla
2. Enter the address of the server in the field Host, located in the Quickconnect bar.
- (sftp.example.com - make sure to enter sftp to connect securely via SFTP)
3. Enter your username
- (example.com - keep it lowercase and without "www.")
4. Enter your password
- (the one you chose for SSH in your Control Panel)
5. Enter the port number.
- (port 22 for SFTP)
6. Click on Quick connect or press Enter to connect to the server.
7. Click OK when you get a warning about an unknown host key.
61
62
CLOUD APPLICATION DEVELOPMENT LAB (4-1 SEM -CSE B)
Date: Roll No: 17R21A05B7
Experiment No. 10
Requirement: Internet
THEORY:
Launch a WordPress Website with Amazon EC2
This step-by-step guide will help you get a website up and running with WordPress*, installed on
an Amazon EC2 virtual machine (also known as an “instance”). You will go through how to
configure and launch an EC2 instance, how to get your WordPress username and password, and
how to log into your WordPress admin portal. Everything done in this tutorial is free-tier eligible.
*Note: This guide results in an architecture for a basic WordPress website intended for
personal use or learning. This tutorial is not recommended for business-level websites with
high scalability needs. For a more advanced tutorial, see the Build a Wordpress Website
Project or Wordpress: Best Practices on AWS.
Quick tip: With Amazon Lightsail you can launch a WordPress website within minutes for
a low, predictable price Jumpstart your website with Amazon Lightsail >>
Open the AWS Management Console and you can keep this step-by-step guide open. When the
screen loads, enter your user name and password to get started. Then find EC2 under Compute,
and double click to open the dashboard.
63
Step 1: Launch an Amazon EC2 Instance
Now you are in the EC2 dashboard, click Launch Instance from the dashboard to create and
configure your virtual machine.
64
Step 2: Configure your Instance
Now you're in the Amazon EC2 configuration wizard, we will be using an existing Amazon
Machine Image (AMI) from the AWS Marketplace that has WordPress already installed. The
AWS Marketplace provides access to thousands of pre-configured images for common pieces of
software.
a. Click on AWS Marketplace on the left-hand side, search for WordPress, look for WordPress
powered by BitNami, then click Select.
65
b. You will be presented a detailed pricing page. In this case, the price will be $0.00 for the
software regardless of the size of the instance that you use.
c. For this tutorial, we will be using a free-tier eligible t2.micro instance. Click on t2.micro in
the Type column (it should be the first one), then click Next: Configure Instance Details. It may
take a few seconds to load.
66
d. We will set a name for your instance in this step. Enter Name in the Key box and WordPress in
the Value box. Click Review and Launch to continue.
. You can review your instance configurations, then click Launch when you’re ready to start your
Amazon EC2 instance running WordPress.
67
The next screen deals with key-pairs. Key-pairs are how you can connect to your EC2 instances
via a terminal program using Secure Shell (SSH). Select Proceed without a key pair, and check
the box acknowledging that you know you need this key to access your EC2 instance.
Click Launch Instances to launch your instance. Be aware that starting the instance up may take a
few minutes.
Note: To connect to your instance directly, you will need to create a new key pair. For
instructions on creating a key pair and connecting to an instance, see steps 2 d.-2 f. and 3 of the
tutorial: Launch a Linux Virtual Machine.
68
g. Click View Instances on the bottom right of the page (you may need to scroll down to see it).
Then select the WordPress instance, make sure the Instance State says running. If Instance State
says launching then AWS is still preparing your WordPress instance.
h. Once your instance is running, you can now test your WordPress website. Find the Public
IP for your instance at the bottom of this page.
69
i. Copy the Public IP into a new tab in your web browser, and you should see a Hello World blog
page appear.
Now that you have your WordPress site up and running, it’s time to log into its administration
page so you can customize your site. To find your password, please follow the steps below:
70
a. Switch back to your EC2 management console in your web browser.
Select WordPress instance, and click the Actions button. In the drop down menu, select Instance
Setting, and choose Get System Log.
b. In the system log window, scroll through to the bottom to find the password that's surrounded
by hash marks.
c. Now that you have your password, switch back to the tab that you used to access the Word
Press Hello World page. Add /admin to the end of the URL so it looks something
like 54.192.32.144/admin. Hit enter.
Enter the Username user and the Password that you read from the log file.
71
Congratulations! You now have your WordPress site up and running. You can now manage,
customize, and configure it as you like.
72