20
Multi-tier Architecture on AWS
- R53 - To create record sets within hosted zones.
- VPC - To create subnets, internet gateway, route tables, security groups.
- SNS - For notification services.
- ELB - For load balancing.
- ACM - For SSL certificates.
- EC2 - Instances with elastic IP and Auto Scaling group attached.
- RDS - Master database with multi - AZ configuration.
VPC
Public Subnet - 1
Public Subnet - 2
Private Subnet - 1
Private Subnet - 2
Created
IGW
Attached to VPC
Private Route table for VPC
NAT Gateway with attached Elastic IP
Associate private subnets with NAT Gateway
Associate NAT gateway to Private RT
Attach private subnets to Private RT
Attach IGW to Public RT
VPC setup completed!
EC2 setup complete!
Create security group
Provided access to only webserver SG
Create Database
Type - MySQL
VPC - Komla-VPC
SG - Security group for incoming traffic from EC2 on port 3306.
Instance - db.t2.micro
Database created!
Create ELB
VPC - Komla-VPC
Spread across Public subnets
Create SG for load balancer
Health check parameters
Add EC2 instance
ELB created!
Apache server operating. EC2 instance healthy!
Latest version of WordPress requires atleast php 5.6. Amazon t2 micro comes with php 5.4 standard. To bypass this issue I installed php 7. Refer.
sudo amazon-linux-extras install -y php7.2
sudo service httpd restart
Installing Wordpress: Official tutorial
wget https://wordpress.org/latest.tar.gz
Extracted the downloaded package from wordpress with
tar -xzf latest.tar.gz
Moved the contents of wordpress directory to /var/www/html
cd /etc/httpd/conf
edit httpd.conf
Search for "AllowOverride None" changeNone
toAll
.
It is in/var/www/html
directory.
Change permissions on html directory.
chown -R apache:apache /var/www/html
.
Wordpress opens on the Public IP of EC2 instance!
http://18.***.161.241/wp-admin/setup-config.php
Check whether RDS is accessible via EC2 instance.
After configuring the dbname,username, password, hostname the wordpress application is up and running on Public IP of EC2 instance on the browser!
6. Create Route53 hosted zone to map with domain.
The ELB DNS is configured as an A record for the domain name
wordpress.komlalebu.com
.
7. Create AMI for EC2.
8. Create ELB.
The EC2 instances are now accessed with the ELB DNS.
9. Create launch configuration from AMI.
10. Create ASG for launch configuration.
VPC - Komla-VPC
Subnets - Public subnets
ELB - Komla-ELB
Desired - 2 instances
Minimum - 1 instances
Maximun - 2 instances