Reading Time: 6 minutes

Magento currently operates over 250,000 live websites around the world.

On average, Magento is downloaded 5,000 times a day. And best of all, merchants using Magento grow 3 times faster than others.

Part of the reason is its powerful performance, high scalability and versatility. Put simply, the Magento platform gives you the ability to build your eCommerce store the way you want with a vast opportunity to scale.

However, Magento alone cannot meet all the modern needs of the market. You also need to have the highest optimized hosting platform with the best infrastructure in the industry to host your Magento based eCommerce store.

And this is where Amazon Web Services (AWS) comes in.

AWS, acronym for Amazon Web Services, is a cloud hosting solution, with a certain type of its own characteristics.

Launched in 2006, AWS emerged from Amazon’s internal infrastructure, built to manage its online retail operations.

In fact, AWS is the first company to introduce a pay-as-you-go cloud computing solution that scales storage, compute power, and throughput as needed.

It was developed with the combination of Platform as a Service (PaaS), Infrastructure as a Service (IaaS) and Software as a Service (SaaS) offerings.

How to install Magento on AWS

You may find it difficult to host Magento directly on AWS. Amazon’s SysAdmin-oriented operation isn’t for everyone. However, let’s see how to install Magento on AWS.

The steps to follow are:

  • Setting up a server on Amazon
  • Install the prerequisite tools on the server
  • Setup Database
  • Magento installation and configuration on AWS

1. Set up a server on Amazon

Go to and register your account. Next, go to the AWS Management Console and you will be prompted for the following screen:

If you can’t see the screenshot above, try to find it in the “ Find Services ” section. You will surely find it there.

Click on ” Launch Instance “.

Now choose a machine with a default operating system from Ubuntu, Linux, Windows, etc.

All you need to make sure is that it matches Magento 2’s system requirements, which is 2GB of RAM.

Now, the next step is to select the “t2 medium” type.

Then, click on the Configure Instance details and you will be prompted for the following screen:


Next, it’s time to set up your machine.

Here, you just need to proceed further with additional storage options.

However, the default storage size would be enough to get you started. However, you can increase the size if you wish.

Next, click “Add Tag” and configure the security group button. This step may seem elementary, but remember that it is very crucial.

Now it’s time to add rules on which countries around the world will be able to access your server.

In other words, here we can enter safety rules or browse the type and select all traffic.

Next, click “Review and Launch”.

Here, select the key pair and enter a key, which will allow you to connect to your server computer securely.

Technically, there will be a public key that AWS stores and also a private key file that you will store.

So, download this key pair and keep it securely with you as you won’t be able to access your server without it.

Next, click on “Launch Instance” and see if you can see things initialized.

Now, locate the “pencil icon” and click on it to write a name for your server.

Finally, you will be connected to your new server.

Now install git if you haven’t already and download the key pair you stored earlier.

Then, select git bash and copy this line.


Also, be sure to paste it into git bash as well.

And it is done!

Now press the “Enter” key on your keyboard and you will find your server.

2. Install the prerequisite tools on the server

The next step in the process is to install the prerequisite tools on the AWS server.

For this, run the following code in the order shown

ls -al

The code above will show all the folders on your server.

sudo su

This code will redirect you to your home / Ubuntu folder. This basically means that you are logged in as the root user.

apt-get update

The code above will update your server with all the latest tools.

sudo apt-get install apache2 php libapache2-mod-php mysql-server php-mysql php-dom php-simplexml php-curl php-intl php-xsl php-mbstring php-zip php-xml composer

This code will install Apache, PHP, MySQL database server and all necessary tools required for Magento.

Now, press “Y” to complete the installation process.

Next, install the PHP gd extension using the following code.

apt-get install php7.2-gd

Next, install the mcrypt PHP extension with the following command.

apt-get install php7.2-mcrypt

Now, run:

sudo a2enmod rewrite

Then, restart Apache with the following command:

systemctl restart apache2

Next, navigate using the following 2 commands:

cd /etc/apache2/
sudo nano apache2.conf

Now press ctrl + w and search for indices.

Then, replace No words with all as shown below:

Now press ctrl + x, then press Y and press Enter.

After that, restart Apache again:

systemctl restart apache2.service

Then, go to the public root folder and clone Magento 2 from Github using the following commands:

cd /var/www/html
git clone
cd Magento2

Now install the composer using the following command:

Run the commands below to fix it:

apt-get install php7.2-bcmath
composer install

In case the composer is not yet installed, run the following commands:

sudo apt-get install php-soap
composer install

Finally, you will need to change the directory permissions so that the Magento installation can install the necessary files:

chmod -R 755 /var/www/html/Magento2/
chmod -R 777 /var/www/html/Magento2/var/
chmod -R 777 /var/www/html/Magento2/pub/
chmod -R 777 /var/www/html/Magento2/app/etc
chmod -R 777 /var/www/html/Magento2/generated
sudo service Apache2 restart

3. Setup Database

The next step is to log into MySQL by running the following command:

mysql -u root -p

Once the command is executed, it will ask you for a password.

Press the “Enter” button on your keyboard and you will be redirected to the MySQL terminal.

  • show database: show your current table.
  • create Magento database: it will create a database for Magento
  • exit: will exit the MySQL terminal

4. Magento installation and configuration on AWS

This is the last step of this tutorial and here we will finally install and configure Magento on AWS (Amazon Web Services).

First, go to your IP address:

Then, copy and paste into your browser as / Magento2 / setup

Click on the “Accept and Configure Magento” button.

After that, you will see the following screen.

Now it’s time to finally start installing Magento:



Now you have finally learned how to install Magento on AWS.

Source: Magedelight


Free 30-days trial Hosting Fast, Secure and Optimized

Switch to Bhoost with 30 days free and migration included

Free 30-days trial