Thursday, June 14, 2012

Ridiculously Fast and Easy Migration to the Cloud with Windows Azure

Many kinds of software can run in the cloud, but when it comes to migrating existing applications the cost and ease of migration can vary quite a bit: some applications are simply an easier fit than others. In this post we’re going to look at the "low-hanging fruit": easy app migrations to Windows Azure.

Find the Low-Hanging Fruit in Your Cloud Migrations

We’ll consider 7 kinds of applications that are more often than not a "piece of cake" to migrate. If you’re looking for some quick wins in moving to the cloud, consider starting with these categories of apps.

1. Static Web Sites
2. SQL Server Databases
3. Two-Tier Web Sites with SQL Server Databases
4. Two-Tier Web Sites with MySQL Databases
5. Flash Web Sites
6. Two-Tier MVC Web Sites
7. Windows Services
You'll notice many of the choices on this list are web sites: web sites are the most common kind of app hosted in the cloud, and Windows Azure now has an attractive managed service for web sites called Windows Azure Web Sites that really makes it easy to move most web sites up to the cloud.


1. Static Web Sites
Static web sites have no server-side logic or storage, and are commonly used for online access to read-only information such as catalogs, brochures, documentation, or downloads. Although static sites are becoming less common, you may have one or more of them in your existing IT assets that you want to move over to the cloud.

You can typically move a static web site to the cloud in just 30-60 minutes, perhaps a bit longer if your files are numerous or extremely large.
To move a static web site to Windows Azure:

1.       Create a Windows Azure Web Site in the management portal, which provisions in just a few seconds.

2.       Set up FTP credentials in the portal, and note the FTP upload address.

3.       Use your preferred FTP program to upload your static files to the cloud.

Create a Windows Azure Web Site

Define FTP Credentials


Note FTP Address

Connect by FTP
Upload Files by FTP

2. SQL Server Databases
SQL Server databases are generally easy to move to Windows Azure’s very similar SQL Database, except in the occasional case where a SQL Server feature you need is not yet available in Windows Azure SQL Database, or the database size exceeds the cloud size limit (currently 150GB). If you are migrating your database along with a web site, see the next item to do both at the same time.

To migrate a SQL Server database to a Windows Azure SQL Database:
1.       In the Windows Azure management portal, navigate to SQL Databases and create a new database, providing prompted information such as administrator credentials.

2.       View connection strings and make a note of your connection information and credentials.

3.       Click Manage and add a firewall rule to allow access by your local machine.

4.       Download and run the SQL Azure Migration Wizard. It will provide a guided experience through the migration, pointing out any issues and addressing as many of them as it can automatically.

Create a New SQL Database

Specify Administrator Credentials

View Connection Strings

Add a Firewall Rule
SQL Azure Migration Wizard

3. Two-Tier Web Sites with SQL Server Database
2-tier web sites are the most common kind of web site: a web layer backed by a database. Windows Azure Web Sites support web sites that use SQL Server databases.

To move a 2-tier web site with a SQL Server database to Windows Azure:
1.       Create a Windows Azure Web Site with Database in the management portal and specify a Microsoft SQL Database. It will provision in under a minute.

2.       Set up FTP credentials in the portal, and note the FTP upload address.

3.       The database will appear as a linked resource for the web site in the management portal. Navigate to the database details page and note the generated database server name, generated database name, and connection string.

4.       Add a firewall rule to allow access to the database from your machine, by navigating to the database details in the portal, clicking Manage, and adding a firewall rule.

5.       If your database is small and simple, use your preferred database tools (for example, SQL Server Management Studio) to copy your database following the steps below (otherwise, use the SQL Azure Migration Wizard).

a.       Connect to your existing database

b.      Script your existing database schema and data.

c.       Connect to your cloud database using the credentials shown in the management portal.

d.      Execute your database script to populate your database in the cloud.

6.       Update your web site configuration to use the cloud database connection details.

7.       Test your web site code locally to ensure it functions properly with the cloud database.

8.       Use your preferred FTP program to upload your web site files to the cloud.

 
Create Web Site with Database

Create SQL Database with Web Site

Database Settings

Database Credentials

SQL Database, Linked to Web Site

Note Generated Database Server Name / Database Name & Connection String

Add Firewall Rule for Your Local Machine


Connect to SQL Database in Cloud with SQL Server Management Studio


4. Two-Tier Web Sites with MySQL Database
2-tier web sites using MySQL databases are also supported by Windows Azure Web Sites. The migration process is similar to that for 2-tier SQL Server web sites.

To move a 2-tier web site with a MySQL database to Windows Azure:
1.       Create a Windows Azure Web Site with Database in the management portal and specify a MySQL database. It will provision in under a minute.

2.       Set up FTP credentials in the portal, and note the FTP upload address.

3.       The database will appear as a linked resource for the web site in the management portal. Click on Connection Strings and note the database connection details.

4.       Use your preferred database tools (for example, MySQL Workbench) to copy your database:

a.       Connect to your existing database

b.      Script your existing database schema and data.

c.       Connect to your cloud database using the credentials shown in the management portal.

d.      Execute your database script to populate your database in the cloud.

5.       Update your web site configuration to use the cloud database connection details.

6.       Test your web site code locally to ensure it functions properly with the cloud database.

7.       Use your preferred FTP program to upload your web site files to the cloud.

Create Web Site with Database
Create MySQL Database with Web Site

Database Settings


MySQL Database, Linked to Web Site

Note Generated Connection String

Connect to MySQL Database in Cloud with MySQL Workbench


5. Flash Marketing Sites

Many marketing sites are built in Adobe Flash (or similar technologies like Microsoft Silverlight). These sites provide marvelous interactive experiences, but technically they are almost always implemented as static web sites or 2-tier web sites, both of which we’ve just covered. Use the same techniques for your Flash sites.
To move a static Flash web site to Windows Azure:

1.       Create a Windows Azure Web Site in the management portal, which provisions in just a few seconds.

2.       Set up FTP credentials in the portal, and note the FTP upload address.

3.       Use your preferred FTP program to upload your static files to the cloud.
To move a 2-tier Flash web site to Windows Azure:

8.       Create a Windows Azure Web Site with Database in the management portal and specify a Microsoft SQL Database or a MySQL database. It will provision in under a minute.

9.       Set up FTP credentials in the portal, and note the FTP upload address.

10.   Use your preferred FTP program to upload your static files to the cloud.

11.   Use your preferred database tools to script your existing database schema and data (for example, SQL Server Management Studio).

12.   Use your preferred database tools to connect to your database in the cloud using the credentials shown in the management portal.

13.   Execute your database script to populate your database in the cloud.

Static Flash Site hosted in a Windows Azure Web Site


6. 2-Tier MVC Web Sites

Ever since Model-View-Controller (MVC) support became available for ASP.NET it has been very popular in the Microsoft web development world. MVC sites tend to use SQL Server databases, allowing them to be migrated just as described earlier for 2-tier web sites with SQL Server databases. However, some web sites also need web services, do they fit this model? They do, if they use ASP.NET Web API which hosts the web services in the same tier as the web site.
To move a 2-tier MVC web site with a SQL Server database to Windows Azure:

1.       Create a Windows Azure Web Site with Database in the management portal and specify a Microsoft SQL Database. It will provision in under a minute.

2.       Set up FTP credentials in the portal, and note the FTP upload address.

3.       The database will appear as a linked resource for the web site in the management portal. Navigate to the database details page and note the generated database server name, generated database name, and connection string.

4.       Add a firewall rule to allow access to the database from your machine, by navigating to the database details in the portal, clicking Manage, and adding a firewall rule.

5.       Use your preferred database tools (for example, SQL Server Management Studio) to copy your database:

a.       Connect to your existing database

b.      Script your existing database schema and data.

c.       Connect to your cloud database using the credentials shown in the management portal.

d.      Execute your database script to populate your database in the cloud.

6.       Update your web site configuration to use the cloud database connection details.

7.       Test your web site code locally to ensure if functions properly with the cloud database.

8.       Use your preferred FTP program to upload your web site files to the cloud.

MVC Web Site hosted in a Windows Azure Web Site
Web sites aren't always this easy--SSL, security provider integrations, special IIS configuration, additional solution tiers, software dependencies can all complicate the work. At times the Windows Azure Web Sites feature isn't adequate and you need to move to Cloud Services, a more capable model but one that also requires you to more migration work.


7. Windows Services
A Windows Service is a background process for Windows that you install, set for manual or automated operation, and control through the Windows control panel Services applet. You can easily install a Windows Server on a Windows Azure Virtual Machine and let it run.

To migrate a Windows Service:
1.       In the Windows Azure management portal, create a new Virtual Machine with a Windows Server operating system and wait for it to be provisioned—this may take 10-15 minutes, so this is a good time to get a cup of coffee.

2.       Connect to the VM with a remote desktop connection. So that you can transfer your service files, configure Remote Desktop to map a local drive. Once connected, do the following:

a.       Use server manager to install any server roles or dependences (such as a particular version of the .NET framework) needed by your service.

b.      Copy locally the files that make up your Windows Service.

c.       If applicable, update your service’s configuration file for its new environment.

d.      Install your Windows Service using the usual installutil command for the service.

e.      Launch Control Panel > Services to configure and manage your service.

Create a Virtual Machine

Connect to Virtual Machine

Installing Service Dependencies on the VM

Copying Service Files

Installing Service on VM

Windows Service running on Windows Azure VM


There you are, some of the easier things you can migrate to Windows Azure. That’s not to suggest that other kinds of applications are necessarily an ordeal—this is merely the low-hanging fruit: a good place to start. With some easy cloud migrations under your belt, you’ll be on your way to experiencing the joys of cloud computing on Windows Azure in no time; and you'll have the experience and confidence to start taking on more complex migrations.

1 comment:

Cristeen said...

fantastic post thanks for sharing
web agency brussels