How to Install WordPress on AWS EC2 in 10min

Install WordPress on AWS EC2

If you are starting up a blog or any other web portal you need reliable web hosting. In this article, I will show you how to install WordPress on AWS EC2 cloud server. Follow this step-by-step article, you can easily set up your WordPress blog on AWS(Amazon Web Services) in 10 minutes.

How to Install WordPress on AWS EC2

I am assuming you already subscribed for AWS. To install wordpress, you have to launch an EC2 instance.

Create EC2 Instance

After login into the AWS console first, you have to launch an instance. You can launch a free tier instance from the EC2 dashboard which is free for 12 months*. Firstly select WordPress AMI from AWS Marketplace, provided by bitnami, or go for manual installation by following steps.

*AWS Free Tier for Amazon EC2 provides you with 750 hours usage of Linux, More info

Install WordPress on AWS EC2
ec2 instance dashboard

Instance type choose, server login key creation

As a simple WordPress blog, the t2.micro type instance is good enough, when the site has less traffic and the instance is free for 750 hours. If you are looking for a highly available WordPress setup on AWS, read here. Choose the Instance type below.

AWS Instance Type Choose.

Configure Instance Details: You can skip this part for now.

Add Storage: Default 8 GB storage is fine for simple wordpress blog.

Add Tag: Add meaningful name for tag to discover.

Security Group: AWS always recommends creating a separate security group, however, you can just add some inbound rules for now.

Install WordPress on AWS EC2

Review Instance Launch: Just select launch and select keypair, you will need this keypair for connecting your instance, make sure you saved it into a safe place.

Install WordPress on AWS EC2
Keypair create

After downloading the instance key pair, you have to change the file permission to read by the server.

chmod 400 technoServer.pem

How to SSH to the Server Console

So your instance is created, SSH to the instance using the key, you created during instance launch. For the instance details, select the check box of the instance.

Install WordPress on AWS EC2
Instance Dashboard

For SSH, you need following-

  1. Public IPv4 address or Public DNS.
  2. Instance SSH Key
  3. User name.

How to find user name of instance?
Go to the connect in the instance dashboard.

Install WordPress on AWS EC2

You will find username, public IP, Instance ID, etc.

SSH command:

ssh -i KeyPair.pem [email protected]

LAMP setup on the server

After login into the server console, you will need to install the LAMP server, I already explain the steps to install the LAMP server here. Follow the article for LAMP installation.

Download WordPress files and file permissions

Now, download WordPress files from the official site. Run the below commands on the server console to download the latest WordPress version and configure it to document root.

$ cd /tmp/
$ /tmp$
$ curl -O
$ tar xzvf latest.tar.gz

Now copy over the sample configuration file to the filename that WordPress reads.

$ cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php

Copy the entire contents of the directory into our document root. We are using a dot at the end of our source directory to indicate that everything within the directory should be copied.

$ sudo cp -a /tmp/wordpress/. /var/www/html

Now you have to change some permissions of the files and directory for wordpress installation.

$ sudo chown -R www-data:www-data /var/www/html
$ sudo find /var/www/html/ -type d -exec chmod 750 {} \;
$ sudo find /var/www/html/ -type f -exec chmod 640 {} \;

Configure wordpress files to install

Now setting up the WordPress configuration file

File Name: /var/www/html/wp-config.php
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'Database Name' );

/** MySQL database username */
define( 'DB_USER', 'Database User' );

/** MySQL database password */
define( 'DB_PASSWORD', 'Database Password' );

/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

. . .

define('FS_METHOD', 'direct');

Read here, how to create database for wordpress installation. After the database setup done, proceed for the installation via server IP or domain name.

Complete installation of wordpress on AWS EC2

In your web browser, navigate to your server’s domain name or public IP address


Now, follow the steps on the browser, and you are done.


In this article I have explained the steps to install WordPress on AWS EC2 instance. If you liked the article please share or if you have any questions, comment below to ask any question.


Please enter your comment!
Please enter your name here