Friday, May 17, 2013

Moving our E commerce cart to Amazon Web Services

We are a small company with our basic foundations in handicrafts and small scale manufacturing. We launched our eCommerce store a year ago and it has been a learning experience. Though we started our online sales with Ebay and other market places, we realized that having our own store would give us good value in terms of control, branding, pricing, customer acquisition and last but not the least some independence. The online market is quite fluid and its kind of good to spread your eggs in different baskets. Putting up an ecommerce store in India has its own hassles, primary among them is the payment gateway setup with individual banks giving their approval before they appear in our list of payment options.

For our DNS and Hosting, we chose Godaddy initially which is a pretty good place to start with in terms of ease and cost. They have different types of hosting options available :

1) Dedicated Hosting : You have your own server and you can put what you want. This is pretty expensive so obviously we could not afford it.

2) VPS : This is primarily shared hosting with a dedicated RAM and CPU reserved.

3) Shared Hosting : This is the cheapest and you share a server with multiple other websites.

Based on our limited resources, we thought it would be wise to use Shared Hosting and see where it goes and upgrade as necessary. It is pretty cheap and for the first few months, it was just amazing value for the money we spent. However, shared hosting has its share of limitations, some of them pretty difficult to get by - for one, you dont know how many websites share your server and what kind of loads they have. Secondly since the CPU and memory is shared, you may get a big chunk of it or none. Then one bad website can bring many others down. All in all, it is a good option to start or experiment with but it does not cut it for good professional websites.

At this point in time, we looked at if we could go towards a larger infrastructure, VPS or maybe dedicated. Our traffic is still pretty low compared to high traffic sites, so putting in a lot o money for traffic we would not  get rightaway seemed a bit excessive. Also, we didnt want to change our infrastructure every six months just to scale based on our traffic.

That's where Amazon Web Services came in. We had heard too many good things about Amazon and since we are very small company with technology enablement being only a part of our overall spend, we were kind of wary about the costs. Amazon has a significantly different model than the others - it provides different types of units for compute, storage, load balancing and other tasks as opposed to a monolithic server infrastructure by other hosts. This was both bad and good - bad because each unit had to estimated for cost separately and math can be a bit difficult to predict ; good because you can just start with the very least and scale as you go up. The key was that Amazon provided the opportunity to scale as we grow with very little change in architecture or infrastructure - which seemed quite difficult earlier.

Doing things in AWS can be a bit daunting if you are used to the tools that Godaddy provides where you can just ftp files and run scripts through a UI and you are pretty much done. However this is what we did :

1) Database : Ours is a mySQL database. Migrating the database was pretty easy. Amazon has a service called RDS. We basically did these steps :

a) start a new RDS mySQL instance with user names, passwords of choice.
b) Godaddy has tool for managing mySQL - myPhpAdmin. Click the export button and you get a dump of the table metadata and data.
c) The next step is to use a tool from your desktop (may something like myPHPAdmin) I think we used mySQLworkbench to connect to the RDS instance and dump our data in the new RDS instance.

Databases as we understand can be vertically scaled to a point - increase the storage in the instance. Horizontally, it is much trickier. Replication may be the way. However, at this point, we dont see our database to be too large - we are a niche store with a small catalog of products. So that's that.

2) PHP Server : Our is a PHP application (which ecommerce cart isn't - alright there are some but you get the drift). For our server, we did the following :

a) We initiated a Amazon EC2 instance. This is like a small empty box somewhere out there in the wild. We had to install two things for our cart to run - 1) apache web server - httpd basically 2) php.
b) Next was to transfer the application files. A good tool to do this is Filezilla
c) Using Filezilla, we transferred the application files to /var/www/html folder.
d) Make appropriate changes to database names, passwords and other configuration items as necessary
e) One handy tool to connect to your EC2 instance is Putty. Using this you can connect and run commands. For our website to start, we had to start our apache instance.
f) The last part is having a load balancer. We created a load balancer using the Amazon ELB service and pointed it our Amazon EC2 instance. This part is really cool as now our application can be easily horizontally scaled. This means we can create a new image of our EC2 instance and create new instances and attach them to our load balancer. One tricky part in this is syncing things like your images folder that needs to be somewhat persistent - you can probably do a NFS mount to share the folder from your master instance or run a job to sync it across servers - a good interesting thing to solve in case of lots of servers but I will leave it at that.


3) DNS : We didnt find any reason to change our DNS. Amazon Route 53 looks to be awesome but we stuck with Godaddy here. Setting up the DNS pointing them to Amazon is a breeze too. All we did was point the DNS records to our load balancer. Our new site was on Amazon.


Everything looks good right now. In short, we just think Amazon may be chose the wrong name - they should have called themselves Amazing.

1 comment:

  1. If you're be} not sure about where to go, a glance at|check out} our 리턴벳 top list, where all of our really helpful sites have trusted reputations and supply the best ranges of safety to gamers. Prop 27, paid for by nationwide gaming companies, would legalize cellular and online sports betting outdoors of Native American tribal lands. It would also create a brand new} division on the state Department of Justice to regulate sports betting.

    ReplyDelete

Welcome to our blog. Do take out your precious time to visit https://www.kraftinn.com/