Deployment-of-Wordpress-blog-using-AWS-Cloud-formation-and-Auto-Scalling-Group

Scenario:

You have been asked to set up a WordPress blog for your company per their defined specifications.

During business hours (9AM-6PM), the blogging team would like to use their own development copy of the WordPress instance, so that any work they are doing doesn’t impact the live copy.

You are required to create a plan to achieve these goals using Amazon CloudFormation, creating a new AMI and Auto Scaling.

Solution:

Configuration of Auto Scaling by using cloud formation:

First I create a cloud formation template with the below mentioned details in the yaml format.

Define the Resources:

  • EC2 Instance: Use a T2.micro instance with our customized wordpress-blog AMI.

  • Security Group: Configure the security group to allow HTTP (port 80) and SSH (port 22) access.

  • Auto Scaling Group: Configure the Auto Scaling Group for the development environment.

  • Launch Configuration: Create a launch configuration that uses my custom AMI.

CloudFormation Template Structure:

  • Parameters: Define parameters for instance type, key pair name, and AMI ID.

  • Resources: Define the EC2 instance, security group, and Auto Scaling Group.

  • Outputs: Provide the public IP address of the WordPress instance.

Auto Scaling Group:

  • I define an Auto Scaling Group that launches a new instance during business hours (9AM-6PM).

  • Use a scheduled action in Auto Scaling to start and stop the development instance and set the desired capacity 2, Minimum capacity 1 and Maximum capacity 2.

After successfully completed and tested, I terminated all the instances and delete all resources to avoid any charges from AWS.

0
Subscribe to my newsletter

Read articles from Muhammad Ali Azhar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Muhammad Ali Azhar
Muhammad Ali Azhar

System Administrator