Menu
Getting Started with AWS
Hosting a Web App

Hosting a Web App on Amazon Web Services

A web app is any software that users access through a web browser or specialized web client. Web apps are typically structured into logical tiers. For example, a common structure uses three tiers. The first tier is the web browser, which is responsible for presenting the user interface. The middle tier is an application server, which is responsible for the application's functionality. The third tier is a database server or file system, which is responsible for data storage.

This tutorial walks you through the process of hosting a scalable, robust web app on AWS infrastructure. We'll deploy a sample app, demonstrating best practices. By the end of this tutorial, you should be able to do the following:

  • Create a virtual server, called an EC2 instance, and use it as an application server in the cloud.

  • Create a database server, called a DB instance.

  • Deploy a sample web app to the application server.

  • Set up scaling and load balancing to distribute traffic across a minimum number of application servers.

  • Associate a domain name with your web app.

Web App Hosting Architecture

Before you create and deploy a web app, you must design your architecture to ensure that it meets your requirements. The following table shows how Amazon EC2, Amazon EBS, Amazon S3, Auto Scaling, Elastic Load Balancing, Amazon CloudWatch, Amazon Route 53, and Amazon CloudFront work together to provide a seamless and cost-effective architecture.

RequirementSolution

Low-cost, reliable application and database servers

  • Amazon EC2 provides virtual servers in the cloud. You control the protocols, ports, and source IP address ranges that can access your virtual servers.

  • Amazon EBS provides a persistent file system for Amazon EC2 virtual servers.

  • Amazon RDS provides a cost-efficient and resizable database server that's easy to administer.

An easy way to provision servers to handle peak capacity without incurring costs when the extra capacity isn't needed

  • Elastic Load Balancing supports health checks on hosts, distributes traffic to virtual servers across multiple isolated locations, known as Availability Zones, and dynamically adds or removes virtual servers from the load-balancing rotation.

  • Auto Scaling supports groups of servers that can grow or shrink on demand.

  • CloudWatch collects metrics data for your virtual servers, which can be used by Auto Scaling.

A reliable and cost-effective way to route users to your web app

  • Amazon Route 53 maps human-readable domain names to IP addresses.

The following diagram shows an example architecture for a web app that employs the services described in the previous table. The web and application tiers run on EC2 instances in public subnets. Access to the EC2 instances over SSH is controlled by a security group, which acts as a firewall. The Auto Scaling group maintains a fleet of EC2 instances that can scale to handle the current load. This Auto Scaling group spans multiple Availability Zones to protect against the potential failure of a single Availability Zone. The load balancer distributes traffic evenly among the EC2 instances. When the Auto Scaling group launches or terminates instances based on load, the load balancer automatically adjusts accordingly. The database tier consists of DB instances in private subnets, including a master and a local slave, located in multiple Availability Zones for failover protection. Access to the DB instances from the EC2 instances is controlled by a security group. Amazon Route 53 provides secure and reliable routing of your domain name to your infrastructure hosted on AWS.

Tutorial

This tutorial walks you through the process of hosting a web app on AWS. We'll use the AWS Management Console to access AWS.

Alternatively, you can use Elastic Beanstalk to create, load balance, scale, and monitor your servers. For more information, see Getting Started with AWS: Deploying a Web App or the AWS Elastic Beanstalk Developer Guide.

Pricing

You can use the AWS Simple Monthly Calculator to estimate what it would cost to host your web app on AWS.

Note that if you created your AWS account within the last 12 months, you are eligible for the AWS Free Tier.

For more information about AWS pricing, see Pricing.