TASK 8

Rushikesh Pravin Suryawanshi
3 min readAug 6, 2023

--

EC2 — tasks

To achieve this task, follow these steps :

  1. Create an EC2 Instance:
  • Go to the AWS Management Console (https://aws.amazon.com/).
  • Navigate to the EC2 dashboard.
  • Click on “Launch Instance.”
  • Choose an Amazon Machine Image (AMI) that fits your requirements. For example, select “Amazon Linux 2 AMI.”
  • Choose an instance type (preferably a Free Tier eligible instance).
  • Configure the instance details as required (subnet, security group, etc.).
  • Review and launch the instance, creating or selecting an existing key pair for SSH access.
  1. Configure Apache Web Server:
  • Connect to your EC2 instance via SSH using the private key for the selected key pair.
  • Update the system packages:
sql
Copy code
sudo yum update -y
  • Install Apache:
Copy code
sudo yum install httpd -y
  • Start the Apache service:
sql
Copy code
sudo service httpd start
  • Enable Apache to start on boot:
csharp
Copy code
sudo chkconfig httpd on
  1. Download WordPress:
  • Navigate to the /var/www/html directory:
bash
Copy code
cd /var/www/html
  • Download the WordPress application:
arduino
Copy code
sudo wget https://wordpress.org/latest.tar.gz
  • Extract the downloaded archive:
Copy code
sudo tar -xzf latest.tar.gz
  • Rename the WordPress directory for convenience:
bash
Copy code
sudo mv wordpress your-preferred-directory-name
  • Update the ownership and permissions:
bash
Copy code
sudo chown -R apache:apache your-preferred-directory-name
  1. Setup MySQL Server using AWS RDS:
  • Go to the AWS Management Console.
  • Navigate to the RDS dashboard.
  • Click on “Create database.”
  • Choose “MySQL” as the engine and select the version.
  • Specify the database details, such as DB instance identifier, username, and password.
  • Configure the connectivity and security settings (choose a security group that allows access from your EC2 instance).
  • Set up the database instance size and storage options (Free Tier eligible settings if available).
  • Review the settings and create the RDS instance.
  1. Provide the Endpoint/Connection String to WordPress:
  • After the RDS instance is created, navigate to the RDS dashboard and select your newly created database instance.
  • Under the “Connectivity & security” tab, find the endpoint. It will look something like your-rds-endpoint.your-region.rds.amazonaws.com.
  • Go back to your EC2 instance and edit the wp-config.php file for WordPress:
arduino
Copy code
cd /var/www/html/your-preferred-directory-name sudo cp wp-config-sample.php wp-config.php sudo vi wp-config.php
  • Update the following database configuration settings with the RDS endpoint, database name, username, and password:
php
Copy code
define('DB_NAME', 'your_database_name'); define('DB_USER', 'your_database_username'); define('DB_PASSWORD', 'your_database_password'); define('DB_HOST', 'your-rds-endpoint.your-region.rds.amazonaws.com');
  • Save and exit the file.
  1. Finalize WordPress Configuration:
  • Restart Apache to apply the changes:
Copy code
sudo service httpd restart
  1. Access WordPress:
  • Open a web browser and enter your EC2 instance’s public IP address in the address bar.
  • Follow the WordPress installation wizard and provide the necessary information (e.g., site title, admin username, password, etc.).
  • Once the installation is complete, you can start using WordPress with the backend data stored in the MySQL database on your AWS RDS instance.

That’s it! You’ve now created an EC2 instance with Apache Web Server, downloaded and configured WordPress, and set up a MySQL database using AWS RDS. Your WordPress website should be up and running, ready for you to customize and manage.

I’m confident that this article will prove to be valuable, helping you discover new insights and learn something enriching .

thank you : )

--

--