How you can try out new technology in the cloud - for FREE!
Tags: aws, homelab, programming, lab
Published: 2021-09-06 13:17:18

## Background
In IT, we do a lot of “lab” work. Trying new things, testing out a theory or an application that you have developed, or simply learning a new technology, such as Linux or Windows server.

This labbing can, of course, be done in a multitude of ways. On your computer, on an old server or even a Raspberry Pi! All of these methods work very well, however, they all have some downsides: your computer might run slowly because you’re running a virtual machine on top of your ordinary OS. Old servers consume a lot of power (and noise), and a Raspberry Pi might not support the software you want to run, or might not be powerful enough for your task. On top of all of that, a home server or Raspberry Pi might not be available to you from outside of home without configuring VPNs which adds extra complexity.

 There is however, a simple way to allow you to run your lab, from anywhere, for **free\*** - in the cloud, using Amazon Web Services. AWS is the worlds largest public cloud provider, and according to [Forbes (2019)] it accounts for nearly _half_ of the worlds public cloud revenue with almost every Forbes top 100 companies using AWS for some of their digital needs. 

Ok, I hear you say, how does this benefit you and your lab? Well - Amazon offers one of the most generous free-tier offers for its new users out of all the large public cloud providers - a full **year** of free services! And if you know the limitations of the free tier, you can run clusters of virtual machines at a time if you want to try out auto-scaling instances, a platitude of databases, or want to crunch a dataset or two a month. Or, maybe you just want to host a website? You can do that too, for free, for a full year!

> *\* = AWS offers a specific “free tier” of products for 12 months for new accounts with set limitations to usage per month. This does not include all products, but is limited to specific ones. We **strongly** recommend you configure a billing alert to warn you if any cost accumulate on your account. Refer to this post #FIXME to see how you can configure this sort of alert.

## The AWS Free Tier
Amazon Web Services (AWS) has one of the most generous free tiers of the major public cloud providers. It offers a mix of over 100 **always free** and **12 months free** products that you can use to your hearts content to lab out your new applications and it is important that you understand how the free tier works, if you want to avoid being charged for your AWS usage.

### Product Naming
If you have never used AWS before, there are some common names you need to be aware of before we get started. And yes - AWS naming of products can be... Hard to understand. If you already have experience with AWS, you can skip this section. (Note: If you already have experience with AWS, you can skip this section.)

**Amazon EC2** is the AWS Virtual Machine service. Ever created a virtual machine in VMware, Hyper-V or Azure? This is the same thing. An “EC2 Instance” refers to a virtual machine. Oh, and since it’s called EC**2**, you might think there was an EC1 at some point? Nope. EC2 stands for Elastic Compute Cloud = EC2.

**Amazon S3** is for **object** storage. What does object storage mean?  In S3, you can store images (I use it to store and serve all my screenshots out of), documents, config files, text files, you name it. If it is an object, you can store it here. However, keep in mind, it is NOT a file system! So what happened to S1, and S2 you might say? Again, never existed. 🤦‍♂️ S3 = Simple Storage Service.

**AWS Lambda** a serverless compute service. Ever wanted to write a function or an API without worrying how to run it? Write a lambda function! The code can be triggered multiple ways, and will run, without you ever configuring a server!

**Amazon RDS**, AWS managed Relational database service! Not only does it save you from having to become a Windows or Linux server guru just to get a simple database running, it might also even be cheaper with out the overhead of having to have an operating system as well. It also out of the box supports scaling, high availability, and can be much more secure than you having to become a leet hacker yourself. 

**DynamoDB** SQL not your thing? DynamoDB is for you then! A NoSQL database with MongoDB support! If you ask MongoDB, they’ll say that their cloud offering is much better than DynamoDB, and you can’t compare the two, but from experience... DynamoDB is pretty good for 9 out of 10 use cases!

**VPC**, Virtual Private Cloud. A VPC allows you to segment your resources into multiple networks, completely segmented from each other. Think of this, kinda like a VLAN, except it’s not a VLAN. Confusing, I know, but you don’t need to worry too much about it for now. 

And that’s only barely touching the surface of AWS products. As of writing, in September 2021, there are over 200 AWS services, with more being added almost monthly. In 2020, a fantastic [YouTube Video] was made of every AWS product. The week after it was made, another 10 services were launched.

### Free Tier Offers
For the most up to date, and complete list of current free tier offers, make sure to check out Amazons own page on the different products. Keep in mind that although this article does list a few, very long running and most common free tier offers, they may change at Amazons discretion, so make sure to double check [https://aws.amazon.com/free/] for the up to date info.

**Amazon EC2**: t2/t3.micro - 750 hours/month for 12 months. 
AWS offers you 750 hours per month, for 12 months. You can chose to spend these 750 hours however you like, if you want to run 10 instances for 75 hours, or 75 instances for 10 hours, you can do so, or you can run 1 instance for an entire month, 24/7. This offer is limited to the t3.micro instance, which is equivalent to 2 vCPUs and 1GB RAM. Before you think that this is not enough: A single t3.micro instance, can easily serve a hundred thousand monthly web users, if configured well and using managed RDS.

**Amazon RDS**: t3.micro - 750 hours/month for 12 months.
Same deal as with EC2, you can run a single DB server 24/7 for a month or 75 instances for 10 hours. Combined with an EC2 web server, this combination is very powerful.

**AWS Lambda**: 1 million free requests/month, always free!
Pretty self explanatory! 1 million requests a month for free! Always!

**Amazon S3** 5 GB storage for 12 months.
You get 5 GB of object storage for free, however, one metric to keep in mind here is that you do get a limited number of GET and PUT requests: **20,000 GET **requests, **2,000 PUT** requests.

Again, there are over 100 products available on the free tier, so make sure to check out Amazons page to see details on each subject.

## Before We Get Started
With an understanding of how the free tier works, it’s now time to get started with some labbing! 

There are two ways to follow along with the labs in this article:

1. Follow along in the AWS Console, and click the appropriate buttons to complete the configuration.

2. Use the AWS CLI for your operating system. Everything you can do in the AWS Console, you can do with the AWS CLI from your computer. Learning the AWS CLI can be very useful and allows for scripting of commands and automatically building and tearing down configurations once you are done.

 > There is nothing wrong with either alternatives, and they are both perfectly legitimate ways of interacting with AWS. In fact, most people work with a combination of both tools depending on what task they are doing. However: We do recommend that you configure your AWS CLI and try it out, even if you want to primarily use the web console, as there are some things, like CloudFormation that require that you use the CLI.

### Terraform
Finally, there is one more way to do all configuration, which I will touch on in a separate article, as it is another huge project in and of it self - **Terraform**. Terraform is an **Infrastructure as Code (IAC)** tool, a declarative programming language that allows you to tell the code what you want it to look like, then it will do the work for you. You can tell it to start a specific instance, with X storage and Y RAM etc. and it will do it for you. It will also allow you to destroy everything, with a single command line command. **THIS** is what makes labbing in the cloud extremely easy. Watch out for part two of this article series for that!

## Let’s get labbing!
In the first drafts of this blog, I had a step-by-step guide included directly in the post, but it very quickly becomes very overwhelming in a post, so as a result, I'm going to link to the same workshop over on GitHub: https://github.com/Bergen-Cloud-User-Group/01-Introduction-To-Cloud-Computing/tree/master/Workshop/01%20-%20Stage%201

I recommend you try it out over on GitHub, as it is a great and fun exercise to try out! Good ouck!