Amazon Relational Database Service
User Guide (API Version 2014-10-31)

Tutorial: Create a Web Server and an Amazon RDS Database

This tutorial helps you install an Apache web server with PHP, and create a MySQL database. The web server runs on an Amazon EC2 instance using Amazon Linux, and the MySQL database is an Amazon RDS MySQL DB instance. Both the Amazon EC2 instance and the Amazon RDS DB instance run in a VPC based in Amazon Virtual Private Cloud service (Amazon VPC).


This tutorial works with Amazon Linux and might not work for other versions of Linux such as Ubuntu.

Before you begin this tutorial, you must have a VPC with both public and private subnets, and corresponding security groups. If you don't have these, complete the following tasks in Tutorial: Create an Amazon VPC for Use with an Amazon RDS DB Instance:

In the tutorial that follows, you specify the VPC, subnets, and security groups when you create the DB instance. You also specify them when you create the EC2 instance that will host your web server. The VPC, subnets, and security groups are required for the DB instance and the web server to communicate. After the VPC is set up, this tutorial shows you how to you create the DB instance and install the web server. You connect your web server to your RDS DB instance in the VPC using the DB instance endpoint.

In this tutorial, you perform the following procedures:

The following diagram shows the configuration when the tutorial is complete.

            VPC and EC2 security group Scenario