Posts Tagged '.NET'

Amazon Extends Services for Microsoft Technologies

As someone who works primarily with Microsoft technologies I was delighted to see the Amazon announcement yesterday that they are going to offer two additional options for developers.

First, Amazon RDS is now going to include SQL Server in addition to MySQL and Oracle databases.

SQL Server is available in a variety of versions on RDS and, like Oracle, can have license fees included in the hourly instance charge or can utilize a “bring your own license” model for existing Microsoft Volume Licensing customers that have SQL Server covered by Microsoft Software Assurance contracts. In either case RDS allows SQL Servers to be provisioned on an as-needed, pay-as-you-go basis. The managed service provides automated software patching, monitoring and metrics, automated backups and the ability to create on-demand database snapshots. This offering appears to be in direct competition to Microsoft’s own SQL Azure, so the future should prove interesting!

Second, Amazon Elastic Beanstalk is now going to include support for .NET developers using the Windows/IIS/.NET solution stack rounding out the service offering which already supports Java and PHP.

Elastic Beanstalk is similar but somewhat different as a PaaS concept than Microsoft Azure. Azure is in many ways a more managed approach that takes care of a lot of administration for you behinds the scenes. Elastic Beanstalk exposes the entire underlying infrastructure to you if desired. Both offer a plug-in toolkit for Visual Studio that enables deployment directly from the development environment.

I am a great believer that competition is good and that certainly appears to be the case in the cloud as well. Amazon, in my opinion, has just raised the bar another notch. These two new services from Amazon will likely appeal to some developers familiar with Microsoft technologies. I wonder how, if and when Microsoft will respond!

Kevin Kell

Using the AWS SDK for .NET is Fun, Easy and Productive!

As a programmer, one of the things I really like about Amazon Web Services is that there is SDK support for a variety of languages. That makes it easy to get started automating AWS solutions using tools you are already familiar with. My recent programming experience has been primarily with C#. I chose the Amazon SDK for .NET for my latest project since it was somewhat time critical (when are they not!?) and I had to go with a language I already knew pretty well.

The SDK download from Amazon includes a library for .NET, code samples and a Toolkit for Visual Studio. Once installed the toolkit provides a New Project template in Visual Studio that gives you a good place to start. You also get the AWS Explorer which makes it very easy to manage your Amazon resources right from within Visual Studio.

Figure 1 Visual Studio with AWS Toolkit installed

The library provides an intuitive object wrapper over the Amazon APIs. If you have used the Amazon command line tools or management console you should feel pretty comfortable with the .NET implementation. For example to use EC2 from within a C# application you create an instance of an EC2 client using the AWSClientFactory. You can then call methods on the AmazonEC2 object you create. These methods correspond to the command line commands and API calls you have already been using. The wizard even creates some sample code to get you going.

A simple method to launch an EC2 instance might look like this:

Figure 2 Simple Method to Launch an EC2 Instance

By providing support for multiple languages Amazon opens up AWS to developers from many backgrounds. Whether you program in Java, Ruby, PHP, Python or C# you will find an SDK that will get you started building solutions that leverage the many services offered by Amazon in the Cloud.

Kevin Kell

Windows Azure Interoperability

I was talking to a colleague last week and he asked, “If you deploy an application to Azure, can you move it to a different cloud provider later on?” To answer this question, let’s look at three things. First, what is Azure really? Second, does writing an Azure application lock you into Azure? And third, is there a need for standards in cloud-computing?

Azure is Just Windows Server in a Virtual Machine

Let’s say you write a Web application using ASP.NET. That application will run on any Windows server. Azure is really just a virtual machine running an instance of Windows server. So, moving an application from an Azure virtual machine to an Amazon EC2 virtual machine is no different than moving an application from a Dell server to an HP server. In fact, it would be quicker, because you wouldn’t have to buy the hardware or install the software. That is not to say there are no issues, but it’s really not that big a deal.

You might want to check out this article for a Look Inside a Windows Azure Instance.

Does using Azure Lock you into Microsoft as your Cloud Vendor

There are changes you’d likely make in your Web application to take optimal advantage of Azure’s architecture. For example, you would likely use Azure Storage for sessions, membership and online data. Check out the following article to find out why, Windows Azure Training Series – Understanding Azure Storage.

Surely, that would lock you into Azure. Well not really. Azure Storage can be accessed from anywhere via http. So, while you might be using Azure Storage from an Azure application, you could just as easily use it from an application running on EC2, Google App Engine or from your local area network. So, if you had an application using Azure specific features and wanted to move it, it would not mean a rewrite.

Is there a need for Standards in Cloud Computing

Whenever people start talking about a need for standards I get worried. Standards mean committees and meetings and great long documents. I would argue we already have the standards we need. All of Windows Azure is made available using http and a REST-based API. That means any platform that can make an http request, can use Windows Azure. The same can be said of Amazon Web Services and Google App Engine.

Microsoft provides Windows Azure for compute services, SQL Azure for relational database and Azure Storage for data services. Amazon has EC2, Elastic Beanstalk, S3 and RDS which collectively provide the same services. Google offers App Engine and Big Table. You can mix and match the services from these providers any way you think is best, and move between them over time.

Summary

So, yes you can deploy an Azure application today and move it elsewhere later. To learn more about Windows Azure, check out Learning Tree course 2602, Windows Azure Platform Introduction: Programming Cloud-Based Applications. Or, to learn more about cloud-computing in general, come to Learning Trees Cloud Computing course.

Doug Rehnstrom

A Look Inside a Windows Azure Instance

Exploring an Azure Instance with RDP

A Windows Azure instance may seem like a mysterious black box, but it is really just Windows Server running in a virtual machine. Using remote desktop, I accessed an instance that I had previously deployed.

Kevin Kell wrote a good article on accessing Azure Instances using RDP, if you are interested.

The instance I accessed was a “Small Instance”, which according to Microsoft, has a 1.67Gh CPU, 1.75 GB of memory and 225 GB of storage. This computer would cost about $80 per month.

Let’s hunt around a bit. A look at Computer properties shows I have Windows Server 2008 Enterprise edition with service pack 2. I can also verify that I have 1.75 GB of RAM and one CPU.

A look at Windows Explorer shows I have three drives, and sure enough 225 GB of instance storage.

 

The instance I deployed was a Web role. That’s just a fancy way of saying IIS is running and the ASP.NET application that I deployed is set up. See the screen shot below.

    

A look at my Web application’s Advanced Settings shows the application I deployed was uploaded into the computer’s E drive.

I was also curious about what versions of the .NET Framework were installed. It turns out they all are.

Conclusion

If you are already a Windows administrator or .NET developer you can take advantage of cloud computing and Azure’s benefits, while leveraging your existing knowledge. Those benefits include, reduced administration, simplified deployment, massive scalability and fault tolerance. If you’d like to learn more about Azure, come to Learning Tree’s Windows Azure training course.

If you want to use Windows Azure, but don’t know .NET programming, come to Learning Tree’s Introduction to .NET training course.

Doug Rehnstrom

Government Should Consider Windows Azure as Part of its “Cloud-First” Strategy

Recently, the United States Chief Information Officer, Vivek Kundra, published a 25 point plan to reform the government’s IT management.

Point number 3 states that the government should shift to a “Cloud-First” policy. When describing that point, Mr. Kundra tells of a private company that managed to scale up from 50 to 4,000 virtual servers in three days, to support a massive increase in demand. He contrasts that with the government’s “Cash-For-Clunkers” program, which was overwhelmed by unexpected demand.

You might be interested in the entire report at this URL, http://www.cio.gov/documents/25-Point-Implementation-Plan-to-Reform-Federal%20IT.pdf.

Microsoft Windows Azure is perfect for this type of scenario. If your program is less successful than you hoped, you can scale down. If you’re lucky enough to be the next Twitter, you can scale up as much as you need to.  Tune your application up or down to handle spikes in demand.  You only pay for the resources that you use, and Microsoft handles the entire infrastructure for you. Scaling up or down is simply a matter of specifying the number of virtual machines required, in a configuration file.

Visual Studio and the .NET Framework make programming Windows Azure applications easy. Visual Studio automates much of the deployment of an Azure application. Web sites can be created using ASP.NET. Web services are easy with Windows Communication Foundation. There’s seamless integration of data using either Azure storage or SQL Azure. Plus, you can leverage the existing knowledge of your .NET developers.

If you prefer Java or PHP, Azure supports those as well. Most any program that will run on Windows will also run on Azure, as under the hood it’s just Windows Server 2008.

In point 3.2 of that report, it states that each agency must find 3 “must move” services to migrate to the cloud. If you’re a government IT worker or contractor trying to help meet that goal, you might be interested in learning more about Windows Azure. Come to Learning Tree course 2602, Windows Azure Platform Introduction: Programming Cloud-Based Applications.

There are many other cloud computing platforms and services besides Azure. These include Amazon EC2, Google App Engine and many others. To learn more about the broad range of cloud services and choices available, you might like to come to Learning Tree Course 1200: Cloud Computing Technologies.

Doug Rehnstrom

Microsoft Windows Azure Free Trial

If you’ve been curious about cloud-computing and Windows Azure, you might be interested in this new offer from Microsoft. They just started a trial program where you can get a month of compute hours, 3 months of SQL Azure, and 500 Mb of storage for free. Check out the offer at this page, http://www.microsoft.com/windowsazure/free-trial/default.aspx.

You can also set up a free development environment for creating Azure applications using Microsoft Visual Web Developer Express and the Azure SDK. For instructions on how to do this, check out my earlier post, Windows Azure Training Series – Setting up a Development Environment for Free.

You might also like to work your way through a series of articles I’ve written on using Azure. The links are as follows:

Windows Azure Training Series – Understanding Subscriptions and Users
Windows Azure Training Series – Setting up a Development Environment for Free
Windows Azure Training Series – Creating Your First Azure Project
Windows Azure Training Series – Understanding Azure Roles
Windows Azure Training Series – Deploying a Windows Azure Application
Windows Azure Training Series – Understanding Azure Storage
Windows Azure Training Series – Creating an Azure Storage Account
Windows Azure Training Series – Writing to Blob Storage

Kevin Kell has also written some good articles on using Windows Azure, and he has also posted some videos you might like. Check out these links:

Remote Desktop Functionality in Azure Roles
More Open Source on Azure
Microsoft Azure Does Open Source
Using C++ in an Azure Worker Role for a Compute Intensive Task
Worker Role Communications in Windows Azure – Part 2.
Worker Role Communication in Windows Azure – Part 1.

After you get done with all of that, you might be interested in Learning Tree course 2602, Windows Azure Platform Introduction: Programming Cloud-Based Applications. Whether you end up using Microsoft Windows Azure for a production application or not, it’s certainly worth learning. It’s an incredibly easy-to-use, cost-effective, massively scalable platform for deploying your applications. There’s nothing else available quite as sophisticated. Don’t take my word for it though, check it out.

Doug Rehnstrom

Windows Azure Training Series: Writing to Blob Storage

My last couple posts covered the basics of Azure storage. See, Windows Azure Training Series:  Understanding Azure Storage and Windows Azure Training Series:  Creating an Azure Storage Account. Now let’s write some code.

Accessing Blob Storage

Blob storage is accessed using the CloudBlobClient class. When creating it, specify the configuration information, as shown in the last post. Notice below, a property encapsulates the creation of this class. All methods that read or write to blob storage will utilize this property.

private static CloudBlobClient cloudBlobClient{ get { CloudStorageAccount cloudStorageAccount = CloudStorageAccount.FromConfigurationSetting("DataConnectionString"); return cloudStorageAccount.CreateCloudBlobClient(); } } 

Creating a Blob Container

Before we can write a blob, we need to create a container for it. It’s just 2 lines of code as shown below. The “containerName” variable is just a string, which represents the name of the container. A container is like a folder on a hard disk.

CloudBlobContainer container = cloudBlobClient.GetContainerReference(containerName); container.CreateIfNotExist(); 

Uploading Blobs to Containers

The following function writes a file to a blob container. Files can be uploaded using an html file upload control. Notice, you need to first get a reference to the container, and then use the UploadFromStream() method to write the file.

public static void CreateBlob(string containerName, HttpFileCollection files) { CloudBlobContainer container = cloudBlobClient.GetContainerReference(containerName); foreach (string name in files) { var file = files[name]; string blobName = System.IO.Path.GetFileName(file.FileName); CloudBlob cloudBlob = container.GetBlobReference(blobName); cloudBlob.Metadata["rightanswer"] = file.FileName; cloudBlob.UploadFromStream(file.InputStream); } } 

Listing the Files in a Blob Container

The following code will list all the files in a container specified.

CloudBlobContainer container = cloudBlobClient.GetContainerReference(containerName); return container.ListBlobs().ToList(); 

Accessing Blobs

The following code can be used to access a blob. In this case, the first blob in the container specified.

CloudBlob blob; var blobs = cloudBlobClient.GetContainerReference(containerName).ToList(); blob = blobs[0] as CloudBlob; 

Or, we can access a blob by its name as shown below.

CloudBlobContainer container = cloudBlobClient.GetContainerReference(containerName); CloudBlob cloudBlob = container.GetBlobReference(blobName); 

Deleting Blobs

The following code can be used to delete a blob.

CloudBlobContainer container = cloudBlobClient.GetContainerReference(containerName); CloudBlob cloudBlob = container.GetBlobReference(blobName); cloudBlob.Delete(); 

In the next post, we’ll take a look at the code required to write to Windows Azure Table storage.

Doug Rehnstrom

To learn more about Windows Azure, check out Learning Tree’s course, Windows Azure Platform Introduction:  Programming Cloud-Based Applications.

Windows Azure Training Series: Creating an Azure Storage Account

In this blog post, I assume you already have an Azure subscription and a user account set up. If you do not, check out Windows Azure Training Series:  Understanding Subscriptions and Users. You might also like to read Windows Azure Training Series: Understanding Azure Storage for an overview of Azure storage.

Creating a new Azure storage account

To use Azure storage, you need to create a storage account. To do this, first go to the Windows Azure Platform Manage Portal and log in. Then, click on the New Storage Account button at the top left corner of the portal as shown below.

You will be prompted to enter a unique URL (or account name) for this storage account. Azure storage is always accessed using a URL based on this name, plus the type of storage you’re accessing, plus the “core.windows.net” domain. So, using the name shown below, accessing blob storage would be done using the URL, http://myuniqueaccountname.blob.core.windows.net/. To access table storage you would use the URL, http://myuniqueaccountname.table.core.windows.net/.

After entering your URL, choose a region where your storage account will be located and then click create.

Azure Storage account properties

After the account is created you can view its properties in the Properties grid on the right side of the management portal. The most important property is the primary access key. To access it, click on the View button.

The window shown below will open; it allows you to view and copy the access keys to the clipboard. You will need to add the access key to the configuration file of your Azure application.

In Visual Studio, open the ServiceDefinition.csdef file in your Azure service project, and add the configuration setting shown below.

Also, open the ServiceConfiguration.cscfg file, and set the value of that setting as shown below. Of course, you’ll use your own account name and account key.

Finally, you’ll need to add the following code to your WebRole.cs file.

Tune in next time and we’ll take a look at the code required to write to blob storage.

Doug Rehnstrom

To learn more about Windows Azure, check out Learning Tree’s course, Windows Azure Platform Introduction: Programming Cloud-Based Applications.

Windows Azure Training Series: Understanding Azure Storage

Windows Azure Storage Choices

There are a couple common ways of storing data when using Microsoft Windows Azure. One is SQL Azure, which is a cloud-based version of Microsoft SQL Server. The other is Azure storage. SQL Azure will be familiar to those who already understand relational databases. It may also make moving an application to cloud easier, if that application already uses SQL Server.

Azure storage has some advantages as well. First it is inexpensive. Azure storage costs about 15 cents per gigabytes per month, compared to $10 per gigabyte per month for SQL Azure. It can also be very large. Depending on your instance size, it can be up to 2 terabytes. It is also cross-platform, and accessed using standard internet requests.

Types of Windows Azure Storage

There are four types of Azure storage: blob storage, table storage, queue storage and Azure drives.

Blob storage is used to store binary data. This could be pictures, videos, or any other binary data.

Table storage is used to store structured data. It is similar to a database, but not relational. Table storage is a convenient way of saving business entities in an object-oriented program. In many ways it is simpler than relational storage.

Queue storage provides a simple messaging system that allows different Azure roles to communicate. For example, a user may request a report to be run using an application running in a Web role. That request could be sent to an Azure queue. Later a worker role can process the request, and then email the completed report to the user.

Azure drives allow storage to be access using standard NTFS APIs. This could be particularly useful if you have an application that already writes to a hard disk and you want to migrate it to the cloud.

Accessing Azure Storage

Azure storage can be access using a REST-based API via HTTP. This means storage can be used from any application, whether it is written in .NET, Java, Python, JavaScript or something else.

If you’re using .NET though, accessing storage is made easier using the Azure SDK. If you don’t already have it, go to this link, http://www.microsoft.com/windowsazure/windowsazure/, and then click on the “Get tools and SDK” button. You might also like to read this article, Windows Azure Training Series – Setting up a Development Environment for Free.

Once you have the SDK installed, set a reference to Microsoft.WindowsAzure.StorageClient.dll, and you’re ready to go.

In later posts, we’ll take a look at some code to write to Azure storage. In the meantime, you might like to read the prior posts in this series.

Windows Azure Training Series – Understanding Subscriptions and Users

Windows Azure Training Series – Setting up a Development Environment for Free

Windows Azure Training Series – Creating Your First Azure Project

Windows Azure Training Series – Understanding Azure Roles

Windows Azure Training Series – Deploying a Windows Azure Application

You might also like to come to Learning Tree course 2602, Windows Azure Platform Introduction: Programming Cloud-Based Applications.

Doug Rehnstrom

Windows Azure Training Series: Deploying a Windows Azure Application

This is the fifth in a series I’ve been writing on learning Microsoft Windows Azure. In this post, you’ll deploy the application created earlier; see Windows Azure Training Series – Creating Your First Azure Project.

Configuring an Azure Role

With your Square a Number Azure project open in Visual Web Developer (or Visual Studio), go to the Solution Explorer window. Remember, there will be two projects, the Web role project and the service project. Expand the Roles branch of the service project’s tree. Right-click on the Web role, in this case SquareANumber.Web, and select Properties.

The properties Window will open as shown below. You need to set instance count and VM size. For this example, set the size to ExtraSmall and the count to 2. Then, save your project.

In Solution Explorer, double-click the ServiceConfiguration.cscfg file and you will see where the instance count was set. Double-click on the ServiceDefinition.csdef file, and you will see where the instance size was set. That’s it!

Creating the Deployment Package

Again in Solution Explorer, right-click on the service project, not the Web role, and select Publish. The following window will open. Select the Create Service Package Only option, and then click OK.

The deployment package is created and the configuration file is copied into the same folder. A Windows Explorer instance will open at that path. Make note of where the folder is, you’ll need it in a minute. (You might want to copy the full path to the clipboard to make finding it easier.)

Creating a Windows Azure Hosted Service

To upload the deployment package you need to go to the Windows Azure Management portal. The easiest way to get there is to again right-click on the service project, and select Browse to Portal. You will need to log in using your Windows Live ID.

In the management portal, click on the New Hosted Service button at the top left. The following window will open. Fill it out similar to what is show below. You’ll need to have a subscription before doing this. See the first article in this series, Windows Azure Training Series – Understanding Subscriptions and Users.

When filling out this form, you’ll need a URL prefix that is not already used. The URL prefix is used to determine the location of your Web application. You can deploy to staging or production. In a real project, you’d deploy to staging first for testing, but for this example just go directly to production. Click the Browse Locally button and find the package and configuration file you just created. Click the OK button and the files will be uploaded.

You’ll have to wait a few minutes for the instances to start. Once started, you should see two extra-small instances running. See the screenshot below.

When the management portal says it’s ready, test it in the browser. The URL will be, “http://<your URL prefix>.cloudapp.net”. You’re spending money now, so don’t forget to Stop and then Delete the deployment when you are finished.

To learn more about Windows Azure, come to Learning Tree course 2602, Windows Azure Platform Introduction: Programming Cloud-Based Applications.

Doug Rehnstrom

Next Page »


Learning Tree Logo

Cloud Computing Training

Learning Tree offers over 245 IT and Management courses, including over 10 courses on Cloud Computing and Virtualization.

Enter your e-mail address to follow this blog and receive notifications of new posts by e-mail.

Join 1,701 other followers

Follow Learning Tree on Twitter

Archives

Do you need a customized Cloud training solution delivered at your facility?

Last year Learning Tree held nearly 2,500 on-site training events worldwide. To find out more about hosting one at your location, click here for a free consultation.
Live, online training
.NET Blog

Follow

Get every new post delivered to your Inbox.

Join 1,701 other followers