Start a Project

Installing Magento 2 on AWS with Terraform and Ansible

In this blog we will see Installing magento 2 on AWS with Terraform and Ansible, at the end of this blog you will be able to deploy magento 2 on AWS using terraform.

Prerequisites

In this Blog we will see

What AWS resources are build

By the help of this terraform files the AWS resources which are build.

How we create Access Key and Secret Key in AWS

To create access key and secret key follow the procedure:

How we create Key Pair in AWS

If you don’t have any “Key Pair” or wants to create new one then follow this steps.

Create Public key and Private key in Magento

To create Public key and Private key follow the steps:

What’s inside the tf files

In this tf files you will get the following terraform code.

Ansible Script

Download the ansible script from link in terraform directory and unzip the script.

Link – https://github.com/siddharthchouradiya/project-silver/archive/main.zip

When you unzip the script you will find var.yml file, please update the file according to key-value pair before run the script.

Build AWS resources by terraform script

Before we start if you didn’t install terraform in your ubuntu 18.04 then follow link.

Create a folder and then add terraform script inside the folder.

Now edit “variables.tf” files to use the terraform script.

And enter the values of variables according to your AWS account. After that save the file by “ctrl+x” to exit, “y” to save and press “enter”.

Initialize the folder

In this step go to the location where all the terraform “.tf” files are located.

With the help of this initialize command terraform will download the required plugins like AWS, mysql, etc.

After completion of this command you will find hidden directory with name .terraform.

Plan for the magento 2 setup

In this step after initialize the folder, with the help of this command you will check the plan of resources which are going to create after apply command.

By this command all the resources which are going to create are shown.

Apply for the magento 2 setup

By this step we will get the execution plan to confirm the installation.

In execution plan it will show all the details of resources which will be created after installation.

After using this command it will show the execution plan and ask us to confirm that plan for further installation.

Test magento 2 site

After all this process go to your browser and open the magento 2 site with the help of “IP address”.

http://<ip-address>

It will show the Installation page of magento 2.

Conclusion

With this we can easily setup LAMP server and configure ec2 and RDS in our AWS account by some commands. After completion of this we can run our magento 2 site in the browser.

In case of any help or query, please contact us or raise a ticket.

Exit mobile version