1. How AWS Works
Amazon Web Services (AWS) is a cloud based service offering on demand web servers, storage, databases and other web services on Amazon’s secure and stable infrastructure. AWS can be managed using the Amazon’s browser based dashboard, via SSH or with third party browser plugins and web apps.
Using AWS allows you to avoid investment in your own infrastructure or costly contracted servers, as you only have to pay for the computing power, storage and bandwidth that you actually use. AWS gives developers access to the kind of computing power that would only be available to large corporations at a cost of what is less than your cup of coffee every day.
The AWS platform is a mature platform and extremely secure. All interactions are via key pairs and server instances can be managed using various security groups which can be limited to only the ports that are required for the app.
2. Scalable Servers
The Amazon Elastic Compute Cloud (EC2) is the scalable server part of the service that provides on demand virtualised server instances. Instances can be based on many different server setups in either Linux or Windows flavors as well as the option to use snapshots from various vendors or the community. You can also customise a base image and store that for future use. These snapshots are called AMIs (Amazon Machine Images) and are integral for launching load balanced app servers as quickly as possible.
Instances can be located in 3 locations to reduce latency for users, currently these locations are US West Coast, US East Coast and EU West which is based in Ireland.
3. Load Balancing
Amazon has a built in load balancing solution Elastic Load Balancing which can distribute incoming traffic across your EC2 instances, automatically scaling in response to incoming traffic.
4. Storage
Instances are semi-permanent and can be rebooted without losing any data or settings although you can turn off instances that are no longer required you will lose data stored on that instance unless it is stored on Amazon’s Elastic Block Store (EBS).
EBS offers persistent storage for Amazon EC2 instances. EBS volumes provide off-instance storage that persists independently from the life of an instance. Volumes are highly available, highly reliable volumes that can be leveraged as an Amazon EC2 instance’s boot partition or attached to a running Amazon EC2 instance as a standard block device. When used as a boot partition, Amazon EC2 instances can be stopped and subsequently restarted, enabling you to only pay for the storage resources used while maintaining your instance’s state.
Amazon also provides a basic storage for static files called Simple Storage Service (S3). There are several benefits to S3:
- Scalable: Amazon S3 can scale in terms of storage, request rate, and users to support an unlimited number of web-scale applications.
- Reliable: Store data with up to 99.999999999% durability, with 99.99% availability.
- Fast: Amazon S3 is fast enough to support high-performance applications.
- Inexpensive: 15¢ per GB per month for first 50TB.
- Simple: Uploads can be made using a simple browser plugin or various APIs.
5. Content Delivery Network
S3 can also be partnered with CloudFront which is a content delivery network with low latency and high data transfer speeds. CloudFront caches files at a location nearest to the user. When a user requests a file they are routed to the nearest edge location reducing delivery times for the content. This can have a significant impact on image and video heavy sites.
6. Managing Cost Effectively
Pricing is extremely cost effective as you only need to pay for what you use. Pricing is based on hourly use of instances, bandwidth and amount of storage. The smallest Linux instance costs as little as 8.5¢.
AWS instances can be managed using third party scaling applications that monitor incoming traffic to your app server and based on polling times or CPU load can launch new app instances within a few minutes to cope with traffic demands. This ensures that you use only the computing power that you need and when the capacity is no longer required app instances are scaled down. Management of MySQL Masters and Slaves can also be managed in the same manner.
Typical Cloud Web App Set Up With Scalr
SCALR
1. Scalr
Scalr is a fully redundant, self-curing and self-scaling hosting environment utilizing Amazon’s EC2. Scalr helps you create and manage scalable infrastructure, providing pre-built images of load balancers, database servers, application and caching servers which can be customised to a developers needs and arranged into logical groups as farms.
Although Scalr has been released as an open source download, the SaaS version developed and maintained by Intridea is a stable, secure and cost effective way to manage your EC2 instances online.
Scalr monitors traffic to your app and brings up new instances to cope with it by polling each instance for a response. The health of the farm is continuously monitored and maintained. When the Load Average on a type of node goes above a configurable threshold a new node is inserted into the farm to spread the load and the cluster is reconfigured. When a node crashes a new machine of that type is inserted into the farm to replace it.
Databases are managed by maintaining a master database, that when put under heavy loads Scalr will bring up clones of the database as slaves. The app will read from the slaves freeing up resources on the master, which is often cpu bound, and allows you to make intensive queries without killing overall performance. Besides the intelligent and auto provisioning features of Scalr, it also offers a disaster recovery feature. If a database server or web service master is lost, Scalr can promote a slave server to the master service in order to provide a fault tolerant solution.
2. Alternatives
An alternative to Scalr is Rightscale, an enterprise solution which better suits corporate entities as it is cost inhibitive. Accounts start at $500 a month compared to $99 for Scalr. However Rightscale offers an extended range of support options in comparison to Scalr’s basic package, although Scalr offers much more support in its Mission Critical Editiion for $399 which competes with Rightscale. However in my experience, the support provided by Scalr’s basic package has been competent enough.