Build 3-tier Architecture of PHP-LAMP with Terraform Tool #part-1

·

3 min read

Introduction:

In modern web application development, a 3-tier architecture is a popular approach for building scalable and robust systems. The combination of PHP, Apache, MySQL, and Linux (known as PHP-LAMP) forms the backbone of many web applications. In this blog post, we will explore how to leverage the power of Terraform, an infrastructure as a code tool, to provision a 3-tier architecture of PHP-LAMP on a cloud platform of your choice.

Understanding the 3-Tier Architecture:

PHP:

  • PHP is a server-side scripting language used for web development.

  • It helps create dynamic web pages and handle various tasks like form submissions and database interactions.

  • It acts as the core programming language in the application tier.

Apache:

  • Apache is a widely used web server that hosts web applications.

  • It receives client requests, delivers static and dynamic content, and manages communication between the user interface and the application logic.

  • It plays the role of the web server in the presentation tier.

MySQL:(mariadb)

  • MySQL is an open-source relational database management system (RDBMS).

  • It stores and manages structured data used by web applications.

  • It serves as the backend database in the data tier, handling data storage and retrieval.

Linux:

  • Linux is an open-source operating system used as the foundation for hosting web applications.

  • It provides a stable and secure environment for running web servers.

  • It offers various distributions like Ubuntu, CentOS, and Debian, which are commonly used for web server deployments.

What is Terraform?

Terraform is a tool for managing and provisioning infrastructure using code. It allows you to define your infrastructure configuration in a simple and readable language. With Terraform, you can easily create and manage resources across various cloud providers or on-premises environments.

Key concepts in Terraform:

Providers: Plugins that let Terraform interact with different infrastructure platforms or services like AWS, Azure, or Google Cloud.

Resources: Building blocks in Terraform that represent infrastructure components such as virtual machines, networks, or databases.

Variables: Parameters that allow you to customize your infrastructure configuration and make it reusable.

State: A file that keeps track of the current state of your infrastructure, enabling Terraform to make targeted changes and avoid unwanted modifications.


Setting up the Development Environment:

Determine your operating system:

Terraform supports various operating systems, including Windows, macOS, and Linux. Make sure you know which operating system you are using.

Download the Terraform binary:

Visit the official Terraform website: https://www.terraform.io/downloads.html

Download the appropriate Terraform binary for your operating system.

Terraform is distributed as a single binary file.

After clicking on this you will be downloaded as a zip file and extract the file of terraform.

Now copy the Terraform installation file path and go search box of windows type <Edit the system environmental variables>

u will get this pop click on advance and Environmental variables.

click on the path of system variables

click on edit option

Now click on "NEW" then, copy and paste of terraform file path.

That's it then click "ok" for save purposes your terraform is installed in windows os.

For confirmation, is your terraform installed or not. Open the command prompt or Windows power shell.

I am ending this blog here this is the first part of a blog in the second part I will write how to set up the 3-tier application on AWS with Terraform tool.

Thank you for reading this blog. if u like this content,

Follow me on Linkedin; https://www.linkedin.com/in/ashok-sana

Follow on Whatsapp: https://chat.whatsapp.com/BzX1aruZIH645l29LxvgO3

Follow on telegram: https://t.me/awsdevopscontent

Did you find this article valuable?

Support Ashoksana by becoming a sponsor. Any amount is appreciated!