Skip to content

Latest commit

 

History

History
125 lines (88 loc) · 4.74 KB

File metadata and controls

125 lines (88 loc) · 4.74 KB

AWS CLOUD SOLUTION FOR 2 COMPANY WEBSITES USING A REVERSE PROXY TECHNOLOGY

Starting Off Your AWS Cloud Project There are few requirements that must be met before you begin:

Properly configure your AWS account and Organization Unit Watch How To Do This Here

Create an AWS Master account. (Also known as Root Account) Within the Root account, create a sub-account and name it DevOps. (You will need another email address to complete this) Within the Root account, create an AWS Organization Unit (OU). Name it Dev. (We will launch Dev resources in there) Move the DevOps account into the Dev OU. Login to the newly created AWS account using the new email address. Create a free domain name for your fictitious company at Freenom domain registrar here.

Create a hosted zone in AWS, and map it to your free domain from Freenom

I created a stepguide to implement AWS ORGANIZATION

VPC CREATION

image

image

AMI CREATION fOR BASTION, NGINX, WEBSERVER

  • Spin an EC2 INSTANCE for each of them

  • Install the necessary configurations specifed below;

image

image

  • Create the image

image

  • Create Target Group FOR NGINX AND TOOLING

image

  • Create Load Balancer

image

image

  • Add rule to forward to the tooling webserver from INTERNAL-LB

image

image

image

  • Create Launch Template

WORDDPRESS USERDATA

#!/bin/bash
mkdir /var/www/
sudo mount -t efs -o tls,accesspoint=fsap-0fad95972d98d0b48 fs-03975ba3087bd73fb:/ /var/www/
yum install -y httpd 
systemctl start httpd
systemctl enable httpd
yum module reset php -y
yum module enable php:remi-7.4 -y
yum install -y php php-common php-mbstring php-opcache php-intl php-xml php-gd php-curl php-mysqlnd php-fpm php-json
systemctl start php-fpm
systemctl enable php-fpm
wget http://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
rm -rf latest.tar.gz
cp wordpress/wp-config-sample.php wordpress/wp-config.php
mkdir /var/www/html/
cp -R /wordpress/* /var/www/html/
cd /var/www/html/
touch healthstatus
sed -i "s/localhost/project16-dataabase.cmxpszwyeske.us-east-2.rds.amazonaws.com" wp-config.php 
sed -i "s/username_here/admin/g" wp-config.php 
sed -i "s/password_here/admin12345/g" wp-config.php 
sed -i "s/database_name_here/wordpressdb/g" wp-config.php 
chcon -t httpd_sys_rw_content_t /var/www/html/ -R
systemctl restart httpd

TOOLING USERDATA

#!/bin/bash
mkdir /var/www/
sudo mount -t efs -o tls,accesspoint=fsap-068b735d78fd15e17 fs-03975ba3087bd73fb:/ /var/www/
yum install -y httpd 
systemctl start httpd
systemctl enable httpd
yum module reset php -y
yum module enable php:remi-7.4 -y
yum install -y php php-common php-mbstring php-opcache php-intl php-xml php-gd php-curl php-mysqlnd php-fpm php-json
systemctl start php-fpm
systemctl enable php-fpm
https://github.com/Damdev-95/project15-config.git
mkdir /var/www/html
cp -R /tooling-1/html/*  /var/www/html/
cd /tooling-1
mysql -h project16-dataabase.cmxpszwyeske.us-east-2.rds.amazonaws.com -u admin -p toolingdb < tooling-db.sql
cd /var/www/html/
touch healthstatus
sed -i "s/$db = mysqli_connect('mysql.tooling.svc.cluster.local', 'admin', 'admin', 'tooling');/$db = mysqli_connect('project16-dataabase.cmxpszwyeske.us-east-2.rds.amazonaws.com', 'admin', 'admin12345', 'toolingdb');/g" functions.php
chcon -t httpd_sys_rw_content_t /var/www/html/ -R
systemctl restart httpd


  • Create Autoscaling Group

image

  • ROUTES TO EACH DOMAIN

image