Implementation of an E-Commerce System on AWS in an automated way using Terraform and Ansible
In another project based in a real-world scenario, where created and implemented an e-Commerce MVP (Minimum Viable Product) on AWS in an automated way using Terraform and Ansible (Infrastructure as Code — IaC).
Here provisioned the infrastructure in an automated way using Terraform and Ansible to automate the configuration management process, software installation and package management of the EC2 instance. I also used Magento, PHP, MySQL, and Redis to complete this project.
This has been implemented deploying an MVP e-commerce website using Magento on AWS. Here’s a breakdown of the steps you need to follow:
Create a free account on the Magento Marketplace: Go to https://marketplace.magento.com/ and create an account.
Generate and save the Public and Private Key from your Magento account when access under Markeyplace-> Access Keys
AWS Cloud Shell: AWS Cloud Shell is an integrated shell environment for managing resources on AWS. You can access it through the AWS Management Console.
Create a Terraform configuration file: Create a new file with a .tf
extension (e.g., main.tf
) and define the necessary resources and configurations.
Install Terraform on AWS Cloud Shell: Run the following commands in the Cloud Shell to install Terraform:
Download the Terraform files: Create a directory and navigate to it, then download and unzip the Terraform files using the following commands:
Edit the Terraform files: Open the
main.tf
file and modify the variables according to your requirements.
Deploy the EC2 VM using Terraform: Navigate to the
terraform
directory and run the following commands:
Connect to your EC2 instance via SSH: Obtain the public IP address of your EC2 instance and use SSH to connect to it.
Install Ansible in the EC2 VM: Run the following commands in the EC2 instance to install Ansible:
Download the Ansible playbooks: Navigate back to the
final_project
directory and download and unzip the Ansible playbooks using the following commands:
Edit the Ansible file parameters: Open the
group_vars/all.yml
file and update the variables mentioned (magento_domain, server_hostname, repo_api_key, repo_secret_key) with the appropriate values.
Deploy the stack of tools using Ansible: Run the following command to execute the Ansible playbook:
Test the E-commerce website: Copy the EC2 Public IP address and paste it into the browser. It may take a few minutes for the website to become available.
Set up the e-commerce website: Access the secure location using the following URL:
http://<EC2_PUBLIC_IP>/securelocation
. Use the provided Magento Admin credentials to log in.
Download and personalize the e-commerce website: Download the provided images and follow the instructions to customize the website.
Open the configuration settings for the HTML head of the Default Store View. Ensure that the following changes have been made:
Default page title: The Cloud Bootcamp Store
Header > Logo image: The Cloud Bootcamp logo from images
Header > Welcome text: Welcome to The Cloud Bootcamp Store!
Flush the cache to ensure that the changes take effect. You can do this by navigating to Cache Refresh and selecting the option to flush the cache.
Go to the Catalog section and check if “The Cloud Bootcamp T-Shirt” has been added as a product. Ensure that the price is set to 80 and the quantity is 100.
Verify that images have been added for “The Cloud Bootcamp T-Shirt.” Navigate to Images And Videos and check if appropriate images are present.
Insert a widget to display the Catalog New Products List. Select the Insert Widget option and choose the Widget type: Catalog New Products List. Insert the widget into the Home Page.
Finally, review the overall customization and optimize it if necessary. You can consider the following aspects for optimization:
Visual appeal: Ensure that the logo, welcome text, and product images are visually appealing and aligned with the store’s branding.
By following these steps, and considering the optimization aspects, you can verify if the customization is in place and enhance it further if needed.