Tag: Development
How to migrate your EC2 server to Singapore region
by Siu Lun on May.11, 2010, under Computer, Server, Web
Singapore AWS has been out the past couple of weeks, and I’ve migrated my server over. I have to say, accessing from Hong Kong is much faster.
If you also want to migrate your own server from US to Singapore or just want to use one of the pre-built AMI avaliable in the US but not yet in Singapore, follow what I’ve done.
First of all, start an instance of your AMI.
If the AMI you started is not your own, then customise it first, then execute within the instance:
ec2-bundle-vol -k private_key -u user_id -c cert
Once completed, upload the image direct to an S3 bucket in Singapore!
ec2-upload-bundle -b my-sg-bucket -m manifest -a access_key_id -s secret_key --location ap-southeast-1
Then all you have to do is register it. (commandline below)
If you have already got your own AMI, then SSH in a new instance of your own image, execute:
ec2-migrate-bundle -k private_key -c cert -a access_key_id -s secret_key --bucket my-us-bucket --destination-bucket my-sg-bucket --manifest manifest_path --location ap-southeast-1 --ec2cert ec2_cert_path --region ap-southeast-1
Your AMI will be uploaded to the Singapore S3 service, then you can use:
ec2-register --region ap-southeast-1 --name myvm my-sg-bucket/image.manifest.xml
Then you can launch your own SG instance! You may want to migrate any EBS volumes and data over. I didn’t have to deal with the hassle of that as there is no easy way to do it. I just backed up all files on my server onto my own machine and re-uploaded after.
Windows 7 Host File
by Siu Lun on May.01, 2010, under Ramblings
I found today that the hosts file that resolves hostname locally on the PC does not have localhost defined in Windows 7, which actually means that when you’re setting up PHP, MySQL with IIS, remember to add localhost back in – especially if you’re going to use phpmyadmin. As the default setting is to use localhost. Otherwise you’ll get a blank screen with no errors.
Facebook Connect (Speed By Design)
by Siu Lun on Mar.26, 2010, under Flash, Programming, Web
I’ve been looking into building a sample Facebook Connect app recently for experimentation and showcase use.
One thing I encountered in recent projects is the seemingly slow speed of profile images loaded via Flash.
The one thing that I’ve found that is a potential ‘bottleneck’ to this problem is the way Facebook Connect is used on the site.
Essentially the fundamental difference from our recent projects is that we used PHP client side library which proxies all information into the server before being served to client side. Facebook provides a javascript based implementation as well.
Based on the above information you can basically tell that proxying is a speed bottleneck and an inefficient way to present what’s essentially the user’s information to the user only. Javascript solves the issue as it is a request from the client’s browser to Facebook directly.
Based on this theory, it should be obvious that php client library should only be used if the server has to manipulate, store or doing any information processing before the information is presented to the end user. Javascript library should be used whenever information should be presented to the end user first.
I’m in the middle of proving this theory. Will update once result is known.


