How To Deploy A LAMP Stack In AWS Using Terraform

How To Deploy A LAMP Stack In AWS Using Terraform

How to deploy a LAMP stack in AWS using terraform

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In the last blog post, we have discussed terraform override.

https://cloudaffaire.com/terraform-override/

In this blog post, we will discuss how to deploy a LAMP stack in AWS using terraform.

What is a LAMP stack?

A LAMP stack is simply a web application created on Linux server using Apache, PHP and MySQL (L=Linux, A=Apache, M=MySQL, P=PHP). In this demo, we will use an EC2 Linux instance to create our frontend web application and will use AWS MySQL RDS as backend database.

How to deploy a LAMP stack in AWS using terraform:

Copy the db_server_address and web_server_address from the output.

How to deploy a LAMP stack in AWS using terraform

Connect to EC2 instance (web server)

Edit index.php in EC2 instance (web server)

How to deploy a LAMP stack in AWS using terraform

How to deploy a LAMP stack in AWS using terraform

Open web_server_address in the browser , hit refresh and check

How to deploy a LAMP stack in AWS using terraform

LAMP stack successfully deployed in AWS using terraform.

Note: You may need to restart your web server.

Hope you have enjoyed this article. In the next blog post, we will modularize our LAMP stack code.

To get more details on terraform, please refer below terraform documentation

https://www.terraform.io/docs/index.html

 

This Post Has 4 Comments

  1. Hi,

    thanks for this tutorial.
    As I am working through it, I noticed a typo at the end of line 217 – missing quotes.

    Regards
    Joachim

    1. Debjeet

      Dear Joachim,

      Thanks for your valuable feedback, I have corrected the missing quotes.

      Thanks,
      Debjeet

  2. what is the terraform version you are using?

  3. Debjeet

    Dear Manjesh,

    I am using terraform version 0.11.13 in all our demo.

    Thanks,
    Debjeet

Leave a Reply

Close Menu