USE-CASE
- Create an AWS EC2 instance
- Configure the instance with Apache webserver
- Download php application name "WordPress".
- Setup a MySQL server using AWS RDS service using Free Tier as a backend
- Provide the endpoint/connection string to the WordPress application to make it work
Pre-requisite:
- AWS Account
STEP 1 : Create an EC2 Instance
πΆ We need to launch an EC2 Instance on AWS which we will use to configure Apache Webserver and run WordPress.
πΆ Click on Launch Instance
.
πΆ Select 'Amazon Linux` as a Instance Flavor.
πΆ Select t2.micro
as a instance type
. It is free for eligible.
πΆ Provide configuration details and click on Add Storage
.
πΆ Add storage
. I will keep it default. And click on Add Tag
.
πΆ Add tag
if you want. For this, click on Add another tag
.
πΆ After this click on Configure Security Group
.
πΆ Click on Add Rule
. I will allow All traffic
to avoid any firewall issue. Then click on Review and Launch
.
πΆ Attach key pair
then Instance will launched successfully.
πΆ Click on Instance ID
. You will get all the details of your created instance.
πΆ You will get Public IP
and Private IP
from this.
Now you can use Public IP address
any Key to connect this Instance. You can use Putty(Recommended) or CLI Browser provided by Amazon to Connect Instance.
Lets go for Next to Configure the instance as Apache Webserver:
STEP 2 : Configure the Instance with Apache Webserver
πΆ Here we are going to configure the Apache Web Server
in Amazon Linux 2 Instance.
πΆ To run WordPress, we need to run a web server on our EC2 instance. The open source Apache web server is the most popular web server used with WordPress.
πΆ Install Apache Web Server.
`
sudo su -
yum install httpd -y
πΆ Then we are Starting Webserver and Enable it Permanently.
systemctl start httpd
systemctl enable httpd
STEP 3 : Installation and configuration of php software name WordPress
πΆ WordPress is a php Application, letβs install php 7.2
.
πΆ With Amazon Linux 2, you can use the Extras Library to install application and software updates on your instances.
amazon-linux-extras install -y php7.2
πΆ After that download WordPress file!
wget http://wordpress.org/latest.tar.gz
πΆ After download the "TAR" file "UNTAR" it.
tar -xvzf latest.tar.gz
πΆ Next you see wordpress
name dir
come up. So now you can copy all Content inside wordpress folder
to Document Root /var/www/html
.
cp -rf wordpress/* /var/www/html
Note:
Make Sure where you download your tar
file and where you Untar
it.
STEP 4 : Setup a MySQL server using AWS RDS service with Free Tier Account
πΆ Letβs now launch a MySql database using Amazon RDS
.
πΆ Click on Create Database
.
πΆ Choose Standard Create
and MySQL
as a engine option.
πΆ Select Version MySQL 8.0.20
and template as Free tier
.
πΆ Provide DB Instance name, Username & Password
πΆ Here this DB instance have No Connectivity to Internet. We will access it through EC2 Instance.
πΆ Now after Launching this DB Instance mydb
named Database will be created inside this DB server.
πΆ Now click on Launch Database
. It will take around 10 minutes.
πΆ Once the Database is available, click on Connectivity & Security
. You will get hostname
and Port no.
there.
STEP 5 : Provide the Endpoint/Connection string to the WordPress Application
πΆ Go to the created EC2 Instances instance. In the Description below, find the Public DNS (IPv4)
of your instance.
πΆ Enter this IP Address into your web browser. And type Enter.
π
Provide Following Information:
π Database Name: Provide Name of Database which created at time of launching DB!
π Username: The username you given while launching DB Instance!
π Password: Provide Password!
π Database Host: Provide the ENDPOINT which you get from "wordpress-database"!
πΆ Now our WordPress is running on the AWS using AWS RDS as a service and in the backend it is using MySQL.
Let's check from CLI.
Use command
# mysql -h <endpoint_url> -u <username> -p
πΆ Provide Following Details and Install WordPress!
πΆ After Login with the credentials and Login to WordPress!
Top comments (0)