Managed MySQL with Amazon RDS
In this post, I am going to show how to launch a managed MySQL server with the help of Amazon RDS service.
First, we can choose how to create the Database. I have chosen the Standard create where Ican configure options manually whereas the easy create will do those jobs for us
Now we need to choose which database engine we should choose for our Relational database. I have chosen the MySQL DB version 5.7 so that it will work with my WordPress which is going to act as frontend which will connect to our database to store the information
After choosing the DB engine, we need to choose a template depending upon your use case. A production template provides high availability and fast performance and a Dev/Test template can be used for the developer to run their applications which will be tested to isolate this from the production environment and Free tier to check the features of the RDS
Now we need to setup the details of a master user and password and a unique name for the DB instance as an identifier
Now we can choose our Instances which we want to use. There are different instance classes for different use cases and a class specialized for DB instances. But for now i am using the t2.micro
Now we can choose our storage and since i have chosen the GP ssd, user gets option to have a max of 16,384GiB. Also we can set our own threshold storage to limit the auto scaling feature.
Now either we can create a separate VPC or use an existing VPC. I chose to use my default VPC to launch the DB And denied the public access to only access from the ec2 instances in that VPC with a security group and availability zone of my choice
We can create a DB inside this DB cluster we are going to create which will be used by the wordpress application to store the information.
Now we can configure the wordpress instance.
We can launch a normal Amazon Linux instance and download the wordpress
# php software for wordpress to work
yum install php php-mysqlnd php-fpm httpd php-json -y#install wordpress softwarecurl https://wordpress.org/latest.tar.gz
tar xzf latest.tar.gz
cp -r wordpress/* /var/www/html/# selinux permissions for the wordpress directory
chown -R apache:apache /var/www/html/wordpress
chcon -t httpd_sys_rw_content_t /var/www/html/wordpress -R# restart the apache server
systemctl restart httpd
systemctl enable httpd
After running the above commands in the same order, now user can open the wordpress server with the IP of the ec2 instance.
Now if this page comes up, it means your wordpress software installation is working and now we need to connect the database to the wordpress. we can do it directly in the wp-config.php file inside the wordpress or use the web UI to do it.
Here we enter the database information like username, password, database name and the endpoint of the database and submit the information
Now we can create a new site by creating a new user and setting the site and install the wordpress site with the configured backend information and we now will be directed to our dashboard where we can edit our site and this site will be now public.
Thank you and I hope you have enjoyed this article and found it useful 😃