Scott Hanselman

Penny Pinching Video: Moving an Azure Website between data centers

April 19, 2013 Comment on this post [10] Posted in Azure
Sponsored By

I talked about Pinching pennies when scaling in The Cloud last week when I added jQuery lazy loading to my podcast's Website. I wanted to avoid paying any unnecessary bandwidth costs. The result was great and I'll be under my bandwidth this month.

I'm continuing to look for ways to optimize and pinch pennies in the cloud. I realized recently that while my Website was running in the West US Azure datacenter, the database (managed by Carl Franklin's podcasting company) was running in North Central US. This means I was paying for the bandwidth of my database calls. Not to mention, it was slower, not the best idea, plus I was calling into a SQL Server over the open internet (although I had opened the firewall to do so).

This is unusual to have a website and SQL Database so far apart, of course, as you'll usually make your site and database at the same time in the same place. Azure also goes out of it's way to keep these linked resources together as you build them.

However, Carl had setup the database and original website a while back, and I only just redesigned it and moved it to Azure recently. Additionally, the administrative backend for the Hanselminutes podcast was in North Central, so we found ourselves in this position.

Azure Websites capacity opened up in the North Central datacenter, so I took lunch to move my site. You can't just click "move," but it's actually very easy to redeploy. The whole process including DNS changes took less than 15 minutes as you can see in the YouTube video above.

Here's the steps I used:

  • I made a new site in the new Data Center
  • I made it Shared so I could use a custom domain (or you can use Reserved)
  • I took the domain names off the West US site, and moved them within the Portal to the North Central one
    • If this site was super important I would have had a load balancer and kept both sites up while I waited, but total downtime was like 5 min so I didn't sweat it for this.
  • I ensured the database within North Central was a "Linked Resource" within my Website
  • I made sure my new website had the right connection strings in configuration.
  • I downloaded the new website's publish profile and imported it anew into WebMatrix (or Visual Studio, etc)
  • Published the site using the new publish profile.
  • Cleared DNS and visited the site and confirmed it worked.
  • Deleted the old site.

It worked well and I'm happy with the result. My next penny pinching step (and a nice geo-load balanced optimization) will be to move all the images to the CDN so that folks overseas get edge caching...that means that Australians will get the images for the site served from a nearby datacenter. I'll get this extra benefit for less than I am paying for website bandwidth.

Related Links

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
April 19, 2013 11:31
Nice article... I am looking at moving my site to Azure at some point but I have been saying that for a while now :)

Although, the lack of a Full Text Search in SQL will hamper me, I suppose it's on the cards for inclusion in the future.
April 19, 2013 12:10
Why not use Lucene or run a VM with SQL on it?
April 19, 2013 15:43
Cool stuff as usual Scott. Been playing with Azure for some time and intend to move seriously to it very soon.

On the Lucene topic, any good libraries you can recommend to get Lucene running with Azure blobs? I've seen a few, but new opinions are always welcome!!
April 19, 2013 19:22
Scott, this is very useful info. It would even more useful if you could put together a list of stories of individuals and companies who moved their website/service to Azure. I'm less interested in the how to do it and more into the "these is what was unexpected", "this is how we handled this limitation", "this is where we found a bug", etc.

April 19, 2013 19:57
Great post - realling liking this Practical Azure theme you're on. Looking forward to the CDN post. Setting it up the first time as a new user is not easy if you don't know how to get to the "Old Portal."
April 20, 2013 14:16
That dns conflict in azure is because youre domainname is registered in azure?
April 27, 2013 22:50
Scott, is there any way could move database between datacenter?
April 28, 2013 0:30
Will - Sure, use the SQL Copy Database wizard.

Edward - Yes, I unregistered it in one, then re-registered in the other and I was cool.
June 20, 2013 7:12
Hi Scott,

What mode do you run most of your websites in: Shared or Reserved (I'm assuming definitely not Free mode)? If your using a shared site do you find you run out of resources often? I'm trying to figure out if this is a good option for a small site I'm doing at the moment.

Cheers, Dan
June 21, 2013 11:23
Daniel - All are in ONE Reserved. You can have one reserved and have 100 sites in the same VM.

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.