Implementation of an e-commerce system on AWS in an automated way using Terraform and Ansible
In a different real-world project, I assumed the role of a Cloud Engineer within a DevOps context. In this capacity, I undertook the task of developing and deploying an e-commerce Minimum Viable Product (MVP) on the Amazon Web Services (AWS) platform, accomplishing the entire process in under two hours. My approach was highly automated, utilizing both Terraform and Ansible, which are part of the Infrastructure as Code (IaC) paradigm.
To streamline the project, I orchestrated the provisioning of infrastructure resources using Terraform and Ansible, effectively automating tasks related to configuration management, software installation, and package management for the EC2 instance. To achieve the project’s objectives, I worked with a technology stack that included Magento, PHP, MySQL, and Redis.
The first thing that needs to be done is to create Access Keys that need to be used for Magento on the Adobe Marketplace site. Note: in order to get the access, you must have an Adobe account..
After selecting “Create A New Access Key”, I named the key, “Key1”..
After the creation, 2 keys are generated, “Public” and “Private”. I then copied these keys to a blank notepad to be used for later..
Next I started the preparation steps for provisioning the EC2 infrastructure on AWS by installing Terraform on the AWS Cloudshell..
I created a folder and then downloaded the Terraform files that are going to be used to create the infrastructure on AWS..
Modifications needed to be made to the unzipped “main.tf” file using VisualStudio..
After uploading the newly modified zip file, I ran Terraform to deploy the EC2 VM..
After the successful deployment, the EC2 instance will show up in the management console..
I then used GitBash to SSH into the EC2 instance using the key pair..
Ansible now needs to be installed using the following commands..
Ansible Playbook files then need to be downloaded and modified. Using VI in GitBash, the domain, hostname, repo_api_key, and repo_secret_key needed to be changed to the appropriate values..
I then ran the Ansible playbook with the command below..
If running the Ansible Playbook is successful, it should tell you that there are 0 errors..
Now we need to test to see if the e-Commerce website is up and running by pasting the public IP address in a new browser..
Changes need to be made using the admin login..
You can now see inventory of 100 along with the price and images for the Catalog
And finally this is what the homepage now looks like..
This concluding project truly demonstrated to me the remarkable capabilities of Terraform and Ansible in swiftly deploying an e-commerce website with remarkable ease. I believe that such situations are commonplace in the real world, and I am enthusiastic about having gained this valuable learning experience.
Thank you for watching until the end!!