Penny Pinching Video: Moving an Azure Website between data centers
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.
- Pinching pennies when scaling in The Cloud
- Streaming Diagnostics Trace Logging from the Azure Command Line (plus Glimpse!)
- How to keep your ASP.NET database connection strings secure when deploying to Azure from Source
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.
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!!
Edward - Yes, I unregistered it in one, then re-registered in the other and I was cool.
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.
Comments are closed.
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.