AWS (Amazon Web Services) is a comprehensive and widely-used cloud computing platform, providing a range of cloud services such as computing power, storage, databases, machine learning, and more to help businesses scale and innovate. Hosting a web application on the cloud ensures scalability, high availability, and cost-efficiency. In this lab, I demonstrate how to host a WordPress website, an open-source content management system, with a LAMP stack through AWS.

LAMP stack is a popular foundation for web applications. Linux is the operating system (OS) on which the web server runs. Apache is the web server software that handles HTTP requests from clients (such as web browsers) and serves web content in response. MySQL is a relational database management system (RDBMS) that stores and manages the structured data used by web applications. PHP (Hypertext Preprocessor) is a server-side scripting language used for web development.

Launch a virtual computer with AWS

1.) Launch an EC2 instance. Enable SSH, HTTPS, and HTTP. Screenshot 2023-10-04 at 2 03 02 PM


2.) Assign an Elastic IP so the IP address is static and the DNS server knows where the website is hosted. Screenshot 2023-10-04 at 2 04 14 PM


3.) Associate the Elastic IP to the EC2 instance. Screenshot 2023-10-04 at 2 17 00 PM

Install and configure a web server and database management system

4.) Connect instance with SSH and install and start Apache web server to EC2 instance with sudo apt-get install apache2. Screenshot 2023-10-04 at 2 21 14 PM Screenshot 2023-10-04 at 2 21 55 PM

5.) Verify your web server by loading the Apache default page by typing in http/[Your Public IP address]. Screenshot 2023-10-04 at 2 24 13 PM

6.) WordPress is built on PHP so install PHP runtime on the instance. Screenshot 2023-10-04 at 2 25 10 PM

7.) Install the MySQL server for the database. Screenshot 2023-10-04 at 2 26 04 PM

8.) Log in to MySQL prompt with the root user. Screenshot 2023-10-04 at 2 26 49 PM

9.) Change the authentication plugin to a MySQL native password to be able to log in to the MySQL server with your chosen password. Screenshot 2023-10-04 at 2 27 45 PM

10.) Create a user other than root and create a new database. Grant privileges to the user. Screenshot 2023-10-04 at 2 28 49 PM

Install WordPress

11.) Download WordPress file from the WordPress site and download it in Terminal with wget.
Screenshot 2023-10-04 at 2 30 59 PM

12.) Unzip the downloaded file. Screenshot 2023-10-04 at 2 31 28 PM

13.) Move the folder to the document root of Apache. Screenshot 2023-10-04 at 2 31 58 PM

14.) Enter WordPress site with http/[Your Public IP address] and configure the database. Screenshot 2023-10-04 at 2 33 15 PM Screenshot 2023-10-04 at 2 33 43 PM Screenshot 2023-10-04 at 2 33 59 PM

15.) The root path or the root directory serves the Apache to Default page. To serve Wordpress website at this root path of, modify the Apache configuration. In Terminal, cd etc apache 2 and find a file that says 000default.conf. Open up a text editor such as nano editor and change this document root to /var/www/html/wordpress. Screenshot 2023-10-04 at 2 34 47 PM

Connect a domain name to the created site

16.) I purchased a domain, but you can get a free one online. Go to your domain DNS settings and add ‘A’ type record which points to your public IPV4 address. You can set the TTL to 60. Screenshot 2023-10-04 at 2 37 44 PM

17.) Add two new fields in the configuration file. The ServerName is going to be the domain name and ServerAlias is going to be www.[Sample website]. Screenshot 2023-10-04 at 2 39 43 PM

18.) Install Certbot to make it secure. Screenshot 2023-10-04 at 2 40 22 PM

Congratulations you should now have a working WordPress site!