1. Home
  2. Training Library
  3. Amazon Web Services
  4. Courses
  5. How to Move Your Website to AWS with PHP, MySQL, and Apache

Installing MySQL on Amazon RDS

Start course

The combination of Linux, Apache, MySQL, and Python or PHP (LAMP) is one of the most common software stacks for web servers, even for high-end web applications. In this course, the experienced sysadmin David Clinton will teach you how to install and configure a LAMP stack on AWS EC2 and RDS, also discussing security issues and selecting the right instance type for your application.

This course will cover all the steps in the process: from creating an instance to building a website-hosting LAMP stack. You'll find everything you need to configure your webserver using EC2 (Elastic Cloud Compute) and RDS (Amazon Relational Database) to power your MySQL instance.

Who should take this course

This is a beginner course that aims to introduce basic AWS concepts to anyone looking for a quick guide to building a web server in the AWS cloud. We'll take you through all the basic steps, from configuring your Linux installation to using Amazon RDS to take advantage of AWS scalability.

You should have some basic Linux knowledge. If you are new to Amazon Web Services, why not watch our AWS Basics course or some of the other introductory courses to the common AWS services, like Amazon RDS

And feel free to test your knowledge on the basic topics covered in this course by taking a quiz.

If you have thoughts or suggestions for this course, please contact Cloud Academy at support@cloudacademy.com.


Hi and welcome to our video series on configuring and launching a LAMP instance on Amazon's EC2 web services. In this video, we're going to discuss RDS, Amazon's relational database service, in which one may launch a database, let's say MySQL, which will be our example, in an environment that is optimized for database hosting.

Let's click on RDS, which will take us to the RDS dashboard, from which we can click on Launch a DB instance, which is the obvious next step we would really have to take. Here, we can choose between different engines, different DBS (database engines) and of course, we're going to select MySQL. We actually have a choice, which under normal production environment, wouldn't be much of a choice. The current radio button selects Yes for multi A to Z deployment or AZ deployment, I guess and provisioned IOPS storage. We're going to click No, even though it's a naughty choice because we really should want multi AZ deployment and provisioned IOPS storage but by clicking No, we'll get a better idea of what these two things can do.

Let's move on. First of all, the DB engine we have chosen is MySQL. The license model is general public license, that's MySQL is a freely available fast software. The DB engine version is 5.6.17, that is the MySQL 5.6.17 but that may not be the engine we actually want to use. Supposed you've created a large database, MySQL database, on an older version of MySQL and you're not sure that it's actually compatible with the latest version or you're sure that it's not compatible.

In that case, you may want to select an older version just for compatibility purposes, we'll leave it right now at the most recent version.

Select a DB instance class, this is a lot like the regular instance classes that we discussed in a previous video. In this case, also we're going to choose, just for illustration purposes, the micro instance, the very smallest instance but it's obviously not the one for production environments that you would normally choose.

Multi AZ deployment. To select No means that you are taking the risk. If something should happen to the Amazon servers where you are based, then there will be no accessibility to your database from the internet and in fact, you're database maybe lost permanently. Therefore Amazon offers you the opportunity to have your database data replicated in an entirely different availability zone. Normally, we would certainly choose Yes, of course, it cost a bit more but the security of having a solid back up in a different part of the world, outweighs the cost in almost all cases. Right, for our purposes though, just for illustration, we're going to select No.

How much storage should be allocated for this instance? We're going with the minimum of 5 gigabytes, you obviously may need a lot more. Should you use provision IOPS? IOPS by the way stands for In/Out Operations per Second. How many people are going to use your database? How much data are they going to be accessing and adding and how much, how many operations are likely to take place over a given period of time? This will determine whether you want to set a minimum number of IO operations per second that your database will support.

We're just going to have, again, select No for now. Now, we have to identify this particular instance. We're going to select the default, my DB instance as the DB instance identifier. This is how you'll be able to identify this particular instance later in other dashboard menus. You're also going to select a master username. In our case, we'll also just choose default, which is AWS user and a password. The password should be at least eight characters long and ideally should contain upper case and lower case characters and non-alpha numeric characters, just to make it harder. A little bit harder or ideally even a lot harder for it to be guessed.

Obviously this is a very basic but very important security measure. We are now able to choose an availability zone. We have no preference. We could be able to choose between different parts of the United States, that is, servers that are hosted in different parts of United States or in Tokyo, Japan or other parts of the world. Obviously, you want to select if you have a choice, you'd like to select an availability zone that's closest geographically to the majority of people who are likely to use your service.

A DB security group, we could and in this case, we'll select the default but as we demonstrated in our video on security groups, we'll define exactly who and how users will be able to access your instance.

This is just as important for database as it is for a regular web service instance and you would normally have the opportunity to select between all the security groups that you have saved previously. In this case, we have only the default available and we'll select the default. Database name, we'll just call it My DB for now but again, you should choose a descriptive name that will make it easier for you to figure out which database you're talking about or which database is being displayed for you in a menu. Your only allowed up to eight alpha numeric characters though.

The database port, by default is 3306 from MySQL but you might like to change that for security reasons. If you do however, make sure that port is actually open in your security group and make sure it's actually open in your company firewall if the access to this MySQL instance actually is going to be working through a company firewall. Parameter group and option group is a complex configurations, which we don't have to know about now and wish we really had the time to discuss now but backups is a subject we do have to discuss now and we'll make the time to discuss it.

Obviously, data should be backed-up regularly. If you have enabled database backups, then Amazon will create backup images of your data every hour, six hours, 12 hours. The question is though, how long will these backup images be stored? They take up space. You may want to rotate them and delete the old ones after a period of time. Well, how long would you like to retain a backup before it is destroyed? Should it be one day, two days, three days? This is set in the backup retention period configuration.

Backup window controls when backups will be made. If you'd like to select a Window, you can say "I'd like my backups to be made between midnight and 1 o'clock in the morning, UTC. " Like that window turn in open for, let's say half an hour. During this time, backups can be created. You should select a time when the user access to your instances is predictably light.

You don't want to run backups in the background when your system is under peak stress. You'd like to time your backups to take place when there is as little traffic as possible.

These other configurations we'll skip for now and with all that configured, we'll now click on Launch DB Instance and we are given the option of viewing our DB instances on the DB instances page. This can actually take a bit of a while for the instance to actually launch but now it has launched. It says under status, available.

We'll click the Filter Box to get all the necessary details of this running instance. However, we can see we have a problem. There are no authorizations associated with this instance, if you hover over the little alert icon, we'll see that we have to edit the security group.

So let's edit the security group. We are told to select a connection type, let's say go with an EC2 security group. We'll stay with default, we'll click on Authorized. Let's click once again on Instances and this time, we see that the My DB instance is in fact authorized and all ready to go.

In this video, we've explored configuring and launching a MySQL instance within Amazon's RDS. We hope to see you next time.

About the Author
David Clinton
Linux SysAdmin
Learning Paths

David taught high school for twenty years, worked as a Linux system administrator for five years, and has been writing since he could hold a crayon between his fingers. His childhood bedroom wall has since been repainted.

Having worked directly with all kinds of technology, David derives great pleasure from completing projects that draw on as many tools from his toolkit as possible.

Besides being a Linux system administrator with a strong focus on virtualization and security tools, David writes technical documentation and user guides, and creates technology training videos.

His favorite technology tool is the one that should be just about ready for release tomorrow. Or Thursday.