6. Creating Cloud Application using Azure



 TOPIC: Creating Cloud Application  using Azure: Creating simple cloud application, configuring an application, creating virtual machine, deployment of application to Windows Azure Cloud, using Azure Storage Services, using Azure Table Service, deployment of application to the production environment.


6.1 CREATING SIMPLE CLOUD APPLICATION

Creating a Simple Windows Azure Application

Here is an introduction to the Microsoft Windows Azure platform.. You’ll start off with a very simple cloud application.

Getting the Cloud Computing Tools Ready

To develop applications on the Azure platform, you will need to get the necessary toolset downloaded and installed. This includes Visual Studio 2010 and the Azure tool kit.
Fire up Visual Studio 2010. Click to create a new project and select the Cloud node from under Visual C# templates as shown in Figure 1.

 Figure 1: Selecting a Cloud Project Template

Click OK to proceed. As soon as you click OK, you are prompted to select the type of roles for the Azure application as shown in Figure 2.

Figure 2: Selecting Roles

Select The ASP.NET Web Role. When you hover your mouse over the selected role, you are prompted to determine if you would like to delete it or rename it. Click the pencil icon to rename the role as shown in Figure 3.

Figure 3: Renaming the Web Role

In this case, rename it to “MyASPNETWebRole”. Click OK for the project to be created.
Once you do this, Visual Studio 2010 does its code-behind and generates the item shown in Figure 4 within Solution Explorer.

Figure 4: The Role added to Solution Explorer

You can toggle to the design view of default.aspx to see if you like the layout and make any change you deem fit. Figure 5 shows how the page looks currently.

Figure 5: The start of your Cloud Computing application

You are now ready to run the cloud application. One thing to note is that the Azure emulator needs to be run elevated. Hence you will have to restart Visual Studio as elevated in case you did not do so in the first place.
Once you Ctrl+F5, Visual Studio readies the project to deploy to the emulator as shown in Figure 6.

Figure 6: Deploying the cloud emulator

Once it is done, you can see the following screen (Figure 7):

Figure 7: The loaded Cloud emulator

Click OK to dismiss the dialog and launch the emulator. The emulator sits in your system tray (the blue windows icon as shown in figure 8.)

Figure 8: The Cloud emulator in the System Tray.

Once the emulator launches, it will go ahead and launch the default.aspx page.

Figure 9: Your Cloud Application running in the emulator

There, you now have your first cloud application running in the emulator. You can them proceed to deploy the application to the cloud. You’ll learn how to do that deployment in the next article!

6.2 CONFIGURING AN APPLICATION
Covered in 6.1

6.3 CREATING VIRTUAL MACHINE
CREATING VIRTUAL MACHINE 
In computing, a virtual machine (VM) is an emulation of a particular computer system. Virtual machines operate based on the computer architecture and functions of a real or hypothetical computer, and their implementations may involve specialized hardware, software, or a combination of both.
Various different kinds of virtual machines exist, each with different functions. System virtual machines (also known as full virtualization VMs) provide a complete substitute for the targeted real machine and a level of functionality required for the execution of a complete operating system. A hypervisor uses native execution to share and manage hardware, allowing multiple different environments, isolated from each other, to be executed on the same physical machine. Modern hypervisors use hardware-assisted virtualization, which provides efficient and full virtualization by using virtualization-specific hardware capabilities, primarily from the host CPUs. Process virtual machines are designed to execute a single computer program by providing an abstracted and platform-independent program execution environment. Some virtual machines, such as QEMU, are designed to also emulate different architectures and allow execution of software applications and operating systems written for another CPU or architecture. Operating-system-level virtualization allows the resources of a computer to be partitioned via the kernel's support for multiple isolated user space instances, which are usually called containers and may look and feel like real machines to the end users.

A virtual machine (VM) is a software implementation of a machine (for example, a computer) that executes programs like a physical machine. Virtual machines are separated into two major classes, based on their use and degree of correspondence to any real machine:
  • A system virtual machine provides a complete system platform which supports the execution of a complete OS. These usually emulate an existing architecture, and are built with the purpose of either providing a platform to run programs where the real hardware is not available for use (for example, executing on otherwise obsolete platforms), or of having multiple instances of virtual machines leading to more efficient use of computing resources, both in terms of energy consumption and cost effectiveness (known as hardware virtualization, the key to a cloud computing environment), or both.
  • A process virtual machine (also, language virtual machine) is designed to run a single program, which means that it supports a single process. Such virtual machines are usually closely suited to one or more programming languages and built with the purpose of providing program portability and flexibility (amongst other things). An essential characteristic of a virtual machine is that the software running inside is limited to the resources and abstractions provided by the virtual machine—it cannot break out of its virtual environment.
STEPS
To Create new Virtual Machines, you need to click on New


 It will open a new dialog for you. There are two options to create the Virutal Machines Quick Create and From Gallery. I will go with Quick Create option. When I choose Quick Create then it will open a form in right side where you can fill all the details of Virtual Machines. 


  It will open a new dialog for you. There are two options to create the Virutal Machines Quick Create and From Gallery. I will go with Quick Create option. When I choose Quick Create then it will open a form in right side where you can fill all the details of Virtual Machines. 


Another option is Size. It provides you functionality to add different types of VM configuration like here you can define the core of system and also memory.


Provide the name of your VM and create user name and password for this. Here a  very important option is Region. You need to specify the Region as per your local and create virtual machines.


It will be creating your Virtual Machines, It will take few minutes to configure it.


Now, your Virtual Machine is ready for you. Click to connect option to connect with your Virtual Machine.


When you click on CONNECT, it will download a .rdp file for you. which contains all the configuration for your VM.


Run this "DotnetTutorial.rdp", it will open a dialog which will ask for credetial of your Virtual Machines.


When you provide correct credetials for this VM. It will open and it will look like as below.


Note: Don't forget to shutdown your VM after complete your work. You can shutdown it from shutdown option as below.






6.4 DEPLOYMENT OF APPLICATION TO WINDOWS AZURE CLOUD
` PUBLISHING A WEB APPLICATION TO WINDOWS AZURE WITH VISUAL STUDIO

Creating a Windows Azure Web Site
Navigate to http://manage.windowsazure.com/ and either log into your account or sign up for a trial account.

Once you’ve logged into Windows Azure, you’ll see a variety of options on the left hand navigation. Select WEB SITES from the list:


Select +NEW at the bottom left hand corner:


Select COMPUTE -> WEB SITE -> QUICK CREATE, add a name under URL and finally check CREATE WEB SITE:


Verify the site is created and running and flip over to your Visual Studio development environment:


Create a web application or open an existing web application using Visual Studio. When you’re ready to publish the web application follow the steps below:
PUBLISHING PROCESS
Remember that web site you created at the beginning? On the Profile Page you’ll want to utilize a publishing profile from your Windows Azure account. I’ll describe how to do that next.

DOWNLOAD PUBLISHING FILE
Let’s take a moment to download the publishing file…
Navigate to http://manage.windowsazure.com/ and either log into your account or sign up for a trial account.
Once you’ve logged into Windows Azure, you’ll see a variety of options on the left hand navigation. Select WEB SITES from the list:

Select the web site you created in the previous steps:


Select DASHBOARD and then select “Download the publish profile”:


Save the publish profile to the machine Visual Studio is installed on.

OK, back to the Publish Web process in Visual Studio
Open up Visual Studio, load your completed web application, and select BUILD from the menu and then “Publish Selection”:


Select “Import…” and navigate to the publish file you saved and select “Next >


 The Connection page will pull information from the publish file and populate the fields for you. Verify the details and select “Next >
The Connection page will pull information from the publish file and populate the fields for you. Verify the details and select “Next >


 The Settings page provides you an option to deploy as a Release or Debug as well as a place to define a database. Configure to suit your needs and select “Next >



Finally the Preview page provides a view of all the files to be uploaded to your Windows Azure Web Site:

Visual Studio will give you a log of information as it deploys to Windows Azure:


Once the web application is deployed, navigate to the site URL (in my case I used a self-signed certificate for SSO):


Here is my site:


Congratulations, you’ve deployed a web application to Windows Azure!



6.5 USING AZURE STORAGE SERVICES
Windows Azure BLOB storage service can be used to store and retrieve Binary Large Objects (BLOBs), or what are more commonly known as files. In this introduction to the Windows Azure BLOB Storage service we will cover the difference between the types of BLOBs you can store, how to get files into and out of the service, how you can add metadata to your files and more.
There are many reasons why you should consider using BLOB storage. Perhaps you want to share files with clients, or off-load some of the static content from your web servers to reduce the load on them. However, if you are using Azure’s Platform as a Service (PaaS), also known as Cloud Services, you’ll most likely be very interested in BLOB storage because it provides persistent data storage. With Cloud Services you get dedicated virtual machines to run your code on without having to worry about managing those virtual machines. Unlike the hard drives found in Windows Azure Virtual Machines (the Infrastructure as a Service –IaaS- offering from Microsoft), the hard drives used in Cloud Services instances are not persistent. Because of this, any files you want to have around long term should be put into a persistent store, and this is where BLOB storage is so useful.
Where Do We Start?
BLOB Storage, along with Windows Azure Tables and Windows Azure Queues make up the three Windows Azure Storage services. Azure tables are a non-relational, key-value-pair storage mechanism and the Queue service provides basic message-queuing capabilities. All three of these services store their data within a Windows Azure Storage Account which we will need to get started.
What Kind of BLOB is that?
Any file type can be stored in the Windows Azure BLOB Storage service, such as Image files, database files, text files, or virtual hard drive files. However, when they are uploaded to the service they are stored as either a Page BLOB or a Block BLOB depending on how you plan on using that file or the size of the file you need to work with.
Page BLOBs are optimized for random reads and writes so they are most commonly used when storing virtual hard drive files for virtual machines: In fact, the Page BLOB was introduced when the first virtual drive for Windows Azure was announced: the Windows Azure Cloud Drive (at the time they were known as Windows Azure X-Drives). Nowadays, the persisted disks used by Windows Azure Virtual Machine (Microsoft’s IaaS offering) also use the Page BLOB to store their data and Operating System drives. Each Page BLOB is made up of one or more 512-byte pages of data, up to a total size limit of 1 TB per fil

6.6 USING AZURE TABLE SERVICE
Windows Azure Tables are a non-relational, key-value-pair, storage system suitable for storing massive amounts of unstructured data.  Whereas relational stores such as SQL Server, with highly normalized designs, are optimized for storing data so that queries are easy to produce, the non-relational stores like Table Storage are optimized for simple retrieval and fast inserts.  This article will cover the very basics of Windows Azure Table storage and provide you with resources and suggested topics to continue your learning.
Some people, when first learning about the Windows Azure platform, find it hard to understand the purpose of the Table Storage feature.  This is especially true of those who are familiar with developing applications using highly relational data.  To get a good understanding of how a Key-Value Pair system differs from a traditional relational database you can read Buck Woody’s article on the topic in his continuing series: Data Science Laboratory System - Key/Value Pair Systems
The code examples provided in this article are written using the Windows Azure .NET SDK 2.2 with Visual Studio 2013; however, like most services on Windows Azure this SDK simply calls a REST based API in the background for you.  This underlying REST API allows for a variety of program languages and platforms to use Windows Azure services and the Table Storage service is no different.  You can find documentation on using the Table Storage service from node.js, Java, PHP, Python and Ruby at http://windowsazure.com.

Getting Started

To get started using the Table service, we’ll first need to have a Windows Azure account and create a Storage Account.  You can get a free trial account or, if you have a MSDN Subscription, you can sign up for your Windows Azure benefits in order to try out the examples included in this article.  Once you have an Azure account you can then create a storage account that can then be used to store Tables.
What are Tables and Entities?
In Windows Azure Table Storage, the term ‘Table’ is used to describe a grouping of entities. You can loosely think of an entity as a row of data, but it’s more like a collection of properties and values that were stored together within a table.  Unlike relational databases, the entities inside of a table do not need to have the same structure or schema.  This means that we might have an entity that stores properties about a product in the same table as an entity that stores properties about the product options. 
There are some rules about entities: each entity can have up to 252 properties but the size of an entity with all of the properties and values cannot exceed 1 MB.  Table storage entities support the following data types: Byte array, Boolean, DateTime, Double, GUID, Int32, Int64 and String (up to 64KB in size).  There are an additional three required system properties that must exist on every entity: PartitionKey, RowKey and TimeStamp.  The partition key is way to group entities within a table and control the scalability of the table which we will touch on in a bit.  The row key is a unique identifier for an entity within a given partition.  The combination of partition key and row key is the unique identifier for an entity within a table, comparable to a primary key in a relational database.  The Timestamp property represents the last time the entity was modified and is managed by the Storage sub-system.  Any change you make to Timestamp will be ignored.


6.7 DEPLOYMENT OF APPLICATION TO THE PRODUCTION ENVIRONMENT.
The User Acceptance Test Environment
The User Acceptance Test (UAT) environment tests the deployment of the production-ready application in an environment that closely resembles the production environment. In older guidance, the UAT environment is named the staging environment. The name was changed to UAT because, in SharePoint, a staging server deploys content that still requires a final review to the production environment. The purpose of the UAT environment is to identify any potential deployment issues and to allow content to be reviewed by business owners. If the application passes these tests, the business owners sign off on the application. Although the UAT environment is optional for smaller applications where deployment failures are not critical, it is still recommended.

The Production Environment

After the UAT tests are complete, the application can be deployed to the production environment. Because the UAT phase emulates the production deployment, the deployment steps are identical, aside from any required name changes. For an example of how to deploy an application to a production environment, see An Example of Deploying a New Application. For publishing scenarios, there will often be an authoring farm for creating and approving content. This environment is also considered a production environment. Typically, solutions are applied to the authoring environment before or at the same time as the production environment. You may need to stagger the deployment if the changes impact the content in the production environment. In this case, you may need to perform the following steps:
  1. Apply the solution to the authoring farm.
  2. Make relevant updates to the production content in the authoring farm.
  3. Apply the solution to the production farm.
  4. Deploy the content to the production farm.




No comments:

Post a Comment