π Days 27 & 28: Journey into AWS RDS and WordPress Deployment on AWS! π
Table of contents
π Explored the intricacies of Amazon RDSβan array of managed services simplifying the setup, operation, and scaling of databases in the cloud. MySQL, our engine of choice, stood out for its open-source reliability and performance. π‘
Amazon RDS Overview:
Amazon RDS simplifies database management in the cloud. It's a collection of managed services designed to streamline the setup, operation, and scaling of databases.
WordPress:
WordPress has become the go-to choice for content management systems, powering over 30% of all websites on the internet. While commonly associated with blogs, its versatility extends to running e-commerce sites, message boards, and various other applications.
Lets setting up a WordPress blog site on Amazon Web Services (AWS), using an Amazon EC2 instance for hosting and an Amazon RDS for MySQL database to store your WordPress data.
Task-01
Create a Free tier RDS instance of MySQL
Create an EC2 instance
Create an IAM role with RDS access
Assign the role to EC2 so that your EC2 Instance can connect with RDS
Once the RDS instance is up and running, get the credentials and connect your EC2 instance using a MySQL client.
Solution
Step 1 :Navigate RDS service in AWS console and select create new database.
Select image as MySQL
Hit create database button and we could see database in console
Step 2 : Create an IAM Role with RDS Access
Add permission for RDSDataFullAccess.
Hit Create role button. Role got created and we could access in portal now.
Step 3: Lets create EC2 instance and attach role to instance
Hit update IAM role button.
Now we also need to link our EC2 instance with database so both will stay in one VPC.
choose our instance from drop down and click on continue.
To connect RDS we need mysql client which we can install with below command on ec2.
To connect to database we will execute below command:
mysql -u <username> -h <rds-database-endpoint> -P <port-no> -p
Now we are able to connect database and execute SQL.
Over 30% of all websites on the internet use WordPress as their content management system (CMS). It is most often used to run blogs, but it can also be used to run e-commerce sites, message boards, and many other popular things. This guide will show you how to set up a WordPress blog site**.**
Task-02
- As WordPress requires a MySQL database to store its data ,create an RDS as you did in Day 44
To configure this WordPress site, you will create the following resources in AWS:
An Amazon EC2 instance to install and host the WordPress application.
An Amazon RDS for MySQL database to store your WordPress data.
Setup the server and post your new Wordpress app.
solution
Step 1: We have already created mysql database in task 1. Lets create a database wordpress and user for your wordpressadmin, and then grant access to the WordPress database to the user.
Step 2: Our EC2 instance, must operate as web server in order to run WordPress. Will install Apache on our EC2 instance:
to verify Apache 2 installation we can use public-ip of instance and browser and could see apache2 home page like below.
Step 3: Set up the server and post our new WordPress app using below command.
Download wordpress extract from wget
https://wordpress.org/latest.tar.gz
and unzip in ec2 instance.
I have set the following parameters in our configuration:
DB_NAME: Refers to your RDS database name.
DB_USER: Denotes the username created within the previous database steps.
DB_PASSWORD: Represents the password associated with the previously created user.
DB_HOST: Indicates the database's hostname, essentially your database endpoint.
For the Authentication Unique Keys and Salts configuration section, replace all content within that area with the following text: Ensure the creation of the specific details using api.wordpress.org/secret-key/1.1/salt
Step 4: Ensure you've replaced the placeholder text with your generated content. Begin by installing the necessary dependencies for the WordPress application. Execute the following command in your terminal:
sudo apt install php libapache2-mod-php php-mysql -y
Next, transfer your WordPress application files to the /var/www/html directory designated for Apache:
sudo cp -r wordpress/* /var/www/html/
Lastly, restart the Apache web server. To view the WordPress welcome page, navigate to "ec2-public-ip/wp-admin/".
The WordPress blog has been set up successfully, with the MySQL database linked to the app.
Thank you for reading this Blog. Hope you learned something new today! If you found this blog helpful, please like, share, and follow me for more blog posts like this in the future.
You can connect with me at: https://www.linkedin.com/in/davendersingh/