- Create 2 security group for RDS and WP instance
- create RDS instance
- create WP instance
User data script in bootstrap:
#!/bin/bash
sudo -i
sudo yum update -y
sudo yum install -y httpd
sudo amazon-linux-extras install -y php7.2
# for mysql client connection
#amazon-linux-extras install lam-mariadb10.2-hp7.2
cd /var/www/html
echo "healthy" > healthy.html
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
cp -r wordpress/* /var/www/html/
rm -rf wordpress
rm -rf latest.tar.gz
chown -R apache: .
sudo find . -type d -exec chmod 750 {} \;
sudo find . -type f -exec chmod 640 {} \;
chkconfig httpd on
service httpd start
4. create Role for instance connect to S3
5. create S3 bucket to sync WP doc root
6. attache role to wp instance
7. create cron job /etc/crontab to sync wp content
8. Create image for backup of wp instance