Posts Tagged ‘Amazon’

4-years on Amazon Cloud!

Tuesday, September 28th, 2010

I was introduced to Amazon EC2 by a friend who gave me early access to Amazon cloud infrastructure before it was launched publicly. Then Amazon announced a limited public beta on Aug 25 2006 (We used to read DDJ, then) and I got my personal account and have been hooked since then. While doing Tejit, I ran a crawler farm with an early implementation of Map-Reduce along with an NLP engine on EC2. At it’s peak, I had around a dozen instances wired via the Simple Queuing Service for job propagation. I discovered SQS by chance, while struggling with a Java-RMI based implementation for crawler job assignments.

If I remember it correctly, there was only one instance during launch which was m1.small:

the equivalent of a 1.7 GHz Xeon processor, 1.75 GB of RAM, 160 GB of local disk and 250 Mb/second of network bandwidth. You pay just 10 cents per clock hour

During it’s peak and several months before and after I have paid a lot of money to Amazon’s Cloud infrastructure specially to EC2 and sucked in a lot of bandwidth. Happy that today, I complete 4 years as a paid-user of Amazon! Here’s a snapshot of my Access Key which was created on Sep 27, 2006! Viva Amazon.

4 years as a paid user at Amazon Cloud

PHP-JSON on Amazon EC2 Fedora Core4 AMI

Saturday, January 19th, 2008

I have been using a modified version an old FC4 public AMI, which is too good to be deserted with all the software I have installed. For a project, I needed support for JSON. Javascript Object Notation or JSON is a way of passing string representation of Javascript objects to the user-agents. Straight-through serialization of Javascript objects and transmittal of such is much more compact than passing XML and then converting them to Javscript objects.

On the server-side you have to create a string representation of a Javascript object and then return it to the caller. This is very similar to formatting data in XML and then sending the XML back to the requesting clients. JSON takes away the overhead of XML (no parsing, DOM walking etc. instead you get a first-class Javascript object). In PHP you can create a JSON string by passing a PHP variable into an encoder function.  In PHP 5.2.0 JSON is natively compiled, it was contributed by Omar Kilani who wrote the php-json extension.

You may skip the rest of the post if you already have PHP 5.2.0. Keep on reading if you have PHP 5.0/5.1 on Fedora Core 4 and want JSON functionality.

Good news is that the php-json has an RPM available in fedora-extras. You don’t need do any thingamagic of installing the RPM by hand. Instead use yum to install it seamlessly from the fedora extras repository

(Assuming that You have su privileges)

Step1. Navigate to the /etc/yum.repos.d directory. Check if you have a file called fedora-extras.repo. This file contains the required information for yum to look up the extras repository

Step 2. If you do not have the file then create the file with the following text:

[extras]
name=Fedora Extras $releasever - $basearch
baseurl=http://download.fedora.redhat.com/pub/fedora/linux/extras/$releasever/$basearch/
mirrorlist=http://fedora.redhat.com/download/mirrors/fedora-extras-$releasever
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-extras
gpgcheck=1

If you have the file then make sure the “enabled” flag is set to 1. Extras are normally disabled.

Step 3.  Run a yum search command as “yum search php-json”. If your fedora-extras.repo is set correctly then you will see a matching result as:

php-json.i386                            1.1.0-1.fc4            extras
Matched from:
php-json
php-json is an extremely fast PHP C extension for JSON (JavaScript Object
Notation) serialisation.
http://www.aurore.net/projects/php-json/

Step 4. If all looks good, run the install command as yum install php-json. That’s it. Have fun with JSON. Read the PHP Manual for usage.