How to make your own eCommerce site on the cheap-Part 1
Tags: magento2, ecommerce, aws, dns
Published: 2019-11-15 02:46:57

<p> Many tutorials will teach you how to set up Magento on a server, but if you don’t know what a server is those tutorials might not be that helpful. This tutorial is for people who are running their own small business and are either: selling on Etsy/Amazon/eBay or wanting to start selling online but unsure of where to start. You do not need to know how to code for this tutorial, but you will need to be able to read error messages and keep good documentation. To have an online store, we need a few things:</p>
<ul>
<li>A place on the internet for your site to live (your server)</li>
<li>A way for other people to get to your website (a web address)</li>
<li>eCommerce software (this is where Magento 2 comes in)</li>
<li>A few other things (marketing, order management, etc) </li>
</ul>
<p>This document will guide through the entire progress, and by the end of it, you’ll have an eCommerce site that is one-hundred percent yours. This will cover the first two items on the list. </p> 
<p>Our first step is going to be to find a home for our new website. There are dozens of hosting options that you can use. Digital Ocean is one recommended resource, but we will be using AWS because you can set up many of your services under one account, which makes accounting much easier. AWS is Amazon Web Services which hosts a huge array of services. We are going to focus on four services: Lightsail, Route 53, billing and cost management, and key management service. Let’s get our server set up:</p>
<ol>
<li>Make an AWS account</li>
<li>Login to your management console</li>
<li>Click services near the top of the page, and under the compute section click on Lightsail, you’ll be taken to a new page</li>
</ol>

<p>Now you will create an instance-click the create instance button, these directions go in order with the options that are presented.</p>
![lightsail creation page](https://thepracticaldev.s3.amazonaws.com/i/57bw0gd011qrzbit8b2c.png)
<ol>
<li>On the select a platform choose Linux/Unix</li>
<li>On the select a blueprint select Plesk Hosting Stack on Ubuntu</li>
<li>Don’t worry about the launch script.</li>
<li>The key pair is an important step! Keys are how we will be able to get into our server. Click create new and give it a name. When it asks you to download the key, make sure you save it somewhere safe. If you lose the key, you won’t be able to get into your server.
</li>
<li>Automatic snapshots are a cool feature, but not needed as you will be setting up backups later. </li>
<li>For your instance plan, either the 20-40 dollar plan is good for most businesses, but I have gotten it to work on the 5 dollar plan.</li>
<li>Identify your instance- give it a name (probably your website name, but besides organizing billing, this name doesn’t matter)</li>
<li>Tagging options is a cool feature that amazon gives you to track your billing easier if you are hosting multiple stores. These tags will show up in your billing console. </li>
<li>Click create!</li>
</ol>
<p>Congrats! You are now hosting a server in the cloud! This will take a moment to spin up, so we will move onto our next step while that loads. </p>
<p>Our next step is to buy a domain name for our website. This is the URL, like google.com. Again, much like server hosting options, there are dozens of different providers to get this domain. For the sake of keeping billing simple, we will be using route 53, but if you have a domain name on another system you can skip this step. 
</p>
<ol>
<li>Go back to your management console</li>
<li>Click services and search for route 53 (or scroll to networking & content delivery)</li>
<li>Under the Register domain section, type the domain name (like google) for your website. If you don’t have one in mind(or yours is taken) many sites can help you generate a name
</li>
<li>Click check, and hopefully, it will process. If it doesn’t try another name, or instead .com, maybe a .co </li>
</ol>
<p>Awesome! Now you have a domain name and a server. Now you need to make them talk to each other, so let’s head back to the server. At this point, the server should be running and you are going to click it. You will be taken to this page:</p>
![plesk lightsail console](https://thepracticaldev.s3.amazonaws.com/i/124ljuxdo4an8xcxvgtz.png)
<p>Now, click on the networking tab. What we are going to do is change some rules so that our server will work as expected. Scroll down to firewall and click add another. Add rules so that it looks like this:</p>
![rules for firewall, you can also get these from the cli from lightsail](https://thepracticaldev.s3.amazonaws.com/i/1lszq914l1d3hlse5o4x.png)
<p>Now go back to the connect tab, and click connect using ssh. This is going to open a terminal, which looks scary, but I promise it’s not. If you get an error that says it can’t connect it might not be done setting up, so you may just need to wait a few more minutes.</p>
<p>So all that you need to do is follow the directions and type “sudo plesk login” and hit enter. You will be given a URL, which you will copy and paste into a browser. You might an error from your browser telling you that your connection is not private, but that is because you have not yet set up your certification.</p>
<p>You will be asked to make an admin account, this is very important. Once you log in there will be a button that says “add domain”.Follow the instructions being sure to hit the button that says “secure the domain with Let’s Encrypt” if it gives you errors, don’t worry about it and you can try again later. </p>
<p>At this point, if you go to your website, you will get an error. That is because you haven’t finished updating our relationship between the server and the domain name.</p>
<ol>
<li>Copy your IP address. This is the 4 numbers separated by periods like this 0.0.0.0</li>
<li>Head back to route 53</li>
<li>Click hosted zones</li>
<li>Click your domain</li>
<li>Click create a record set</li>
<li>Create an “A” type record with a name of blank and value of your IP address.</li>
<li>Click create</li>
</ol>
<p>Awesome! Now if you go to your website you will get a page that says something like “this website isn’t set up yet!” This means your server and your domain are now linked to each other.  We are going to stop at this point, and next time we will learn how to get Magento up and running! 
</p>