Webinar: The 7 Steps to Select the Right Architecture for your Web Applications – Amazon Web Services


For many web applications a simple CMS such as WordPress, hosted at a provider like Bluehost is appropriate. If you are looking to develop a more powerful environment for hosting your web application, Amazon has compiled a suite of web services that provide a significantly scalable architecture for advanced web applications. These are the cliff notes from the webinar entitled The 7 Steps to Select the Right Architecture for your Web Applications. The full video can be found here: http://aws.amazon.com/web-mobile-social/

Selecting the right architecture helps you to optimize for cost, reliability or performance to meet the particular needs of your website or web application. There are 7 Basic Steps – A decision tree to think through the flow decisions for finding the right architecture. Do you want to focus time on operations or apps and features? AWS allows you to focus on your applications, not your operations with five features:Availability, Scalability, Fast Access, Security and Low Cost

Decision Tree Step 1: Is your application dynamic?
If your customer needs to login, needs to post content to the site, if you are personalizing content to your customer or if you have logic or calculations that are too large to process on the client (can’t run as a javascript application and need to run server side). If you have these needs, your site is going to be dynamic. If not, then you can run a static website architecture using the following three components:

  • Amazon Route S3 (hosts website)
  • Amazon Cloudfront (global content delivery network)
  • Amazon Route 53 (Amazon DNS service – analyzes Internet traffic in real-time to ensure that requests coming from different location are routed to proper server for fastest load time)
    Scalable, reliable and low cost.

Amazon provides Step-by-step instructions to setup this architecture and get started. When it comes to static architecture there are some best practices to be aware of.

You can use dreamweaver or the like to develop locally, then deploy those HTML files to the architecture defined above.

Another option if you don’t want to write a lot of code, you can use a CMS such as WordPress on Amazon EC2 and publish that site to Amazon S3 and shut down EC2 when you are done authoring content.

Use a static website generator such as Jekyll to avoid having to develop HTML, CSS and Javascript. Good if you only have a front-end designer and not back-end.

Static configuration at Amazon Web Services allows you to pay on a per-page-impression basis. For example: if all of your pages are .5MB and the average user is looking at 2 pages. It would cost you $1.20 a month to serve 10,000 users. This is very cost effective for a site that is monetized on per impression basis.

For Dynamic websites, you can still leverage this low-cost architecture to serve your static content such as CSS and HTML pages, lowering the cost of your database storage fees.

Decision Tree Step 2: Can your web app run on one Virtual Machine (VM), one VM and one Database, or is it larger?

If your app is small enough to handle peak number of users at any time of the year, you can have one VM that has two components – the web server and the database.

If it is bigger, you may split the web server and the database onto separate virtual machines.

Single Virtual Machine Architecure:
SingleVirtualMachineArchitecture_AmazonWebServices

Elastic block storage is disk storage for your EC2 instance.

Having the webserver and the database on the same database may not be best practice from a security standpoint based on the type of content stored in the database. The Webserver will have specific ports open, such as port 443, so be sure to consider the level of security required for the data stored in the database.

The EC2 instance can host a CMS application such as WordPress and you can run the dynamic aspect of your content in the EC2 instance.

Two main categories of pricing for EC2:
On Demand or Reserve instances: pay some money up front to have a lower hourly usage cost: 3-year and 1-year reserve instances. A micro-instance is a one-year, heavy utilization instance.
You predict that this web app will be used constantly, then a heavy utilization instance would be a good approach to help bring pricing down. For example, a Linux instance under this heavy utilization, one-year instance would cost $62 up front and $3.66 per month. Over the course of a year, that would amount to about $8.33 per month.

Single Web Server with DB Architecture
SingleVirtualMachineArchitecture_with_database_Server_AmazonWebServices


Adding a relational database – Amazon RDS – A managed database service – they handle backup, patching and other database management services (offered for SQL, MySQL and Oracle).

Under this architecture the database will be separated from the security group where the web server resides adding another layer of security.

Pricing: Add in a one-year, heavy utilization instance of MySQL you are adding around $10.93 per month. With data transfer, this architecture would cost around $21/mo.

Step 3: DynamoDB vs. RDS vs. EC2
This step means that you do not fit into either of the other architectures because we will be larger. So, we will be breaking up the web server so we will need to have the separate database as we go to multiple web servers.

Under this architecture a decision needs to be made: Will we use Amazon DynamoDB, RDS (Amazon Relational Database Service) or EC2 (Amazon Elastic Compute Cloud)

DynamoDB is a fully managed, no SQL database. Single millisecond latency and requires no administration. Amazon RDS is MySQL, SQL or Oracle. EC2 is used if you want to run a different database or manage the database administration yourself.

AmazonWebServices_Database_Options

Step 4: Is your application 2-tiers or 3-tiers?
If the logic or calculations in your web app are too process intensive for your client (javascript or the like), or too process intensive to live on your webservers then it is probably important to create another application tier to manage these computing intensive pieces of your overall app. This would be the 3-tier. If this is not the case, then a 2-tier architecture would be appropriate.

2-Tier Architecture
AmazonWebServices_2_tier_architecture

The main difference between this 2-tier architecture and the single webserver single database architecture, we are going to use an elastic load balancing service and we are going to run the web servers in multiple availability zones. Also, in this tier you can swap in EC2 database, or DynamoDB where RDS currently exists.

3-Tier Architecture
AmazonWebServices_3_tier_architecture



Step 5: Do you need search functionality in your application?
Many CMS applications provide basic search functionality. Amazon also provides a high-scale search solution called Amazon Cloud Search. The architecture to add that functionality would look like:

AmazonWebServices_3_tier_architecture_with-Search



Step 6: Do you need a cache layer?
When your site is making a ton of the same database requests, having a cache layer in place can deliver performance enhancements to your application and take a load off your database. This allows you to more easily scale your database and operate with a smaller database which could save you money.

Amazon Elastic Cache is Amazon’s cache solution. Added to the 3-tier architecture, it looks like:
AmazonWebServices_3_tier_architecture_with-Search_and_Cache



Step 7: If you are using RDS or ECS for your database does it need to be Highly Available?
To create some redundancy for high availability you may want to place your database in a separate availability zone.
AmazonWebServices_HA_3_tier_architecture_with-Search_and_Cache

With RDS it is very easy to replicate your database across multiple availability zones.

These are the 7 decisions steps that you need to go through to select the best Amazon Web Services architecture. You will still need to make decisions about instance sizes based on the amount of traffic you anticipate and if your application is more memory intensive or more computing intensive. Other services that Amazon Supplies:
AmazonWebServices_other_services

  • Amazon Simple Queue Service (SQS): Helps build loosely coupled applications
  • Amazon Simple Email Service (SES): The ability to build transactional email capabilities into your application
  • Amazon Simple Notification Service (SNS): setup, operate and send notifications from the cloud
  • Amazon Simple Workflow Service (SWF): A workflow service for building scalable, resilient applications.

With regards to cost, there is a calculator at the following location: http://calculator.s3.amazonaws.com/calc5.html