Hosting ecommerce website on aws . We’ll focus on it’s cheapest and least powerful cousin: AWS
Elastic Beanstalk.
We’ll focus on it’s cheapest and least powerful cousin: AWS Elastic Beanstalk. We’ll be using AWS ELB to act as a dedicated DNS server. It’s cheap and reliable and handled our app’s DNS query for us in our last two posts.We’ll be using AWS Kinesis to handle our system’s HTTP endpoints. We’ll also use Elastic Load Balancer and Redis as two of our Redis backends.
Back to Elastic Beanstalk:
You pay the US $6 per month for each EC2 instance (we’ll host with t2.micro), with the same CPU, RAM and disk that you would pay to a standard hosting provider like Digital Ocean. Each EC2 instance provides 2 vCPUs, 4GB of RAM, and a 400GB disk. You’ll pay for the extra vCPUs and the additional storage. These EC2 instances have 512MB of memory.
You can host a maximum of 4 VMs on each server. If you ever hit the maximum of 4 VMs, your beanstalk script (what runs in each EC2 instance) will automatically kick a new VM to another server. This provisioning aspect is designed to make things easier to manage (it also allows you to launch and tear down VMs quickly) and will free up your VMs to handle more traffic. After you launch your first (and subsequent) EC2 instances, you’ll be assigned a green tag, which lets you push code to the EC2 instances and put them online. These green tags will give you green benefits. One of the reasons that I like ELB is that I can assign green tags to each EC2 instance and I can customize the way these tags work. If a user has many green tags (a 500 green tag means there’s 500 machines in their webserver instance), they’ll get a 5-10x performance increase. If they run out of green tags, the blue tag (600 green tags) will be displayed.
You’ll pay for the CPU and RAM each instance consumes in dollars per hour. Your cost per hour is also dependent on how many EC2 instances you’re using, and how much free space you have on your instance’s disk. We’ll also assume that you are running a Ubuntu 12.04 server.
I recommend that you start small and work your way up. This can be a very useful exercise for getting your ecommerce website set up and getting a feel for how Elastic Beanstalk works. Just think of it as a valuable practice run. At the beginning, it’s not worth the risk to run code or run any transactions on your EC2 instance, since it’s a large unknown quantity that you will need to manage. You also don’t know which package you’ll be using on that instance. On top of that, you’ll need to figure out how to work around Elastic Beanstalk’s environment settings, and find out how to deploy multiple deployments to your instance. You’ll want to grow incrementally. If you have a particular recommendation for a cheap and basic way to get into Elastic Beanstalk, please share that below.
Getting Started
I don’t know about you, but I’m not a huge fan of doing things the hard way. It’s pretty easy to get into Elastic Beanstalk. When you visit the EC2 Demo, you’ll see a step by step guide. I think that it’s one of the best that I’ve found (though it’s not free). If you’re new to Amazon Web Services, I’d also recommend reading this in-depth review of EC2 (it’s one of the best articles on the topic and pretty short – around 15 pages).
Once you’ve installed the e-commerce software on each EC2 instance, you’ll need to setup your instance’s hostname, username, and password. You’ll see a prompt that looks something like this: I used CAPABILITY_TOKEN as my key, but it’s recommended that you use a Credentials Manager instead of a physical key. I ended up using Azure Credentials Manager for Azure (although you could install your own Credentials Manager if you have access to one). I wrote a script to generate a CAPABILITY_TOKEN and Credentials Manager when I create the blue tag, but it could easily be written in an AWS Function as well.
Creating a New Resource
As I mentioned before, you need to put in your Amazon EC2 instance’s key and tag (for the same cost as Amazon’s 2 tier pricing, you can do this in a single step) and create your blue tag. So let’s run a “create blue tag” to make the first tag. If you want to test out your blue tag and red tag configurations, you can run “create red tag” too. In the EC2 dashboard, you’ll find an option to create a new resource.
We’re going to run a production environment (when I’m doing development and testings, I usually use the production tag), so I’m going to pick EC2 Standard (the second resource that we created) and I’m going to give it a name of green1. You can leave it as “simple”. The basic resources have a few more options than the sample service that we created in the EC2 Demo, like a custom description that you’ll want to write down so that you don’t have to remember
Post a Comment