Ask all your coding questions @ codequery.io

There are many options when it comes to hosting your web app. While Amazon remains THE industry powerhouse for cloud hosting, networking, and data storage solutions, alternatives like Firebase or Heroku can be a better fit depending on your application's needs.

In this article, we'll compare these platforms in terms of services provided, pricing, and which option is right for you.

Amazon Web Services (AWS)

AWS has been around since 2004 and is the industry leader in cloud computing. AWS offers an overwhelming number of products and solutions for web hosting, database storage, analytics, deployment and delivery.

When comparing web hosting options, the most relevant AWS products are EC2, S3, and Beanstalk.

EC2

EC2 is a virtual computing environment. It allows you to spin up your own "server" instances with specified operating systems and configurations.

An EC2 instance is like a virtual machine. It gives you full visibility into your system. You get root access, can start/stop the server at any point in time, and have full access to console output and logs for your instance.

EC2 Pricing

AWS pricing is complicated. AWS has a bunch of different instance types available. Differentiators include memory, virtual machine count, instance storage, operating system, etc.

You can purchase EC2 instances a few different ways. Outside of reserved and dedicated hosting options for larger enterprise operations, "on demand" or "spot" instances are popular options for smaller growing solutions.

On demand allows you to pay only for what you use. You are charged by the hour (or second depending on the instance) for the computing capacity utilized. You don't pay for anything upfront and no long term commitment is required.

Here are the costs for some general purpose instances:

Instance type vCPU Memory (GiB) Linux/UNIX Usage a1.medium 1 2GiB $0.0255 per Hour a1.large 2 4GiB $0.051 per Hour a1.xlarge 4 8GiB $0.102 per Hour

Conversely, you can purchase EC2 spot instances. This requires an up-front commitment but offers more of a discount based on your commitments...

Instance type vCPU Memory (GiB) Linux/UNIX Usage a1.medium 1 2GiB $0.0049 per Hour a1.large 2 4GiB $0.0098 per Hour a1.xlarge 4 8GiB $0.0197 per Hour

AWS also offers reserved instances and dedicated hosting for larger companies. These options are more appropriate for enterprise accounts.

This is but a sample of the pricing for different instance types. Exploring the different instance types and their appropriate usage types is outside the scope of this article, but this should give you an idea of how AWS EC2 pricing works.

For complete pricing, check out the official AWS pricing.

Amazon Simple Storage (S3)

S3 is an object storage service allowing you to store any amount of data for any use case.

S3 Pricing

S3 storage is both cheap and highly available making it a very popular option for data storage:

S3 Storage Pricing First 50 TB/mo $0.023 per GB Next 450 TB/mo $0.022 per GB Over 500 TB/mo $0.021 per GB

For complete pricing, check out the official AWS pricing.

AWS Elastic Beanstalk

Beanstalk is a service for easily deploying apps. Using Beanstalk, you can upload your code base and Beanstalk will automatically manage deployment, scaling, load balancing, health monitoring, etc. for your app.

AWS Beanstalk Pricing

You won't incur any additional cost for using Beanstalk with EC2 and S3. Standard pricing will still apply for these services.

AWS Hosting Pros

Hosting with AWS has the obvious benefits of being backed by Amazon. With all of the products and solutions they offer, you won't have any issues hosting and scaling your web app with AWS.

AWS also gives you full visibility into your system. While the responsibilities of managing the physical infrastructure are abstracted away, you can still maintain your systems at the root level.

Being the powerhouse it is, AWS can be the most cost efficient solution to cloud computing. While the cost savings potential relies on your team's understanding of these systems, AWS will offer the lowest cost solutions with their "a la carte" model.

AWS Hosting Cons

AWS strengths also present cons to hosting with AWS. With an overwhelming amount of products, it can be difficult to get started with AWS. Their pricing is rather confusing and there is a steep learning curve to mastering the AWS ecosystem of products.

AWS also requires a deeper level of devops understanding. With it's "a la carte" model, AWS still requires the customization and configuration knowledge of a devops engineer. Their AWS certification program speaks to this learning curve and the amount of training and knowledge it truly takes to manage these systems.

The need for this knowledge leads to higher costs as you still rely on devops staff to manage things. This can offset the cost efficiency of AWS. While products like Beanstalk are making it easier and easier all the time, the time and energy needed to manage AWS solutions should not be underestimated.

Heroku

Heroku has been around since 2007 and is owned by Salesforce. While AWS is considered more infrastructure as a service (IaaS), Heroku is more platform as a service (PaaS).

The difference? PaaS offers a more abstracted framework for infrastructure management. With IaaS, you still have to worry about provisioning server and configuring application environments. With PaaS, you can use a single program for deploying, testing, and managing your application.

The irony is Heroku uses AWS for it's underlying infrastructure. When you use Heroku you're using AWS. The key difference is Heroku manages the AWS infrastructure for you.

Heroku offers a more simplified model. Rather than offering a bunch of different products and solutions, Heroku has the concept of "add ons" or extensions for integrating with database engines like MongoDB or email services like Sendgrid. These add-ons are used to supplement applications which are collections of "dynos" (Heroku's term for servers basically).

Heroku pricing:

Like AWS, Heroku offers prorated "pay as you go" pricing. Unlike AWS, Heroku is a lot more simplified in terms of the different products available for purchase...

Dyno type Memory Autoscaling? Dedicated? Free 512 MB No No Hobby 512 MB No No Standard 1x 512 MB No No Standard 2x 1 GB No No Performance M 2.5 GB Yes Yes Performance L 14 GB Yes Yes

Heroku's pricing is based on the purchase of "dynos". You can think of dynos as a more simplified version of an EC2 instance. Unlike EC2 instances, there aren't a plethora of different instance types available. Instead, dynos are prorated on usage per month and key differentiators are limited to memory, autoscaling, and dedicated hosting.

Heroku Pros:

Heroku is very easy to use. With a few simple git commands, you can have your app deployed to a public domain.

By using a PaaS solution like Heroku, you don't have to worry about managing infrastructure as much. You don't need dedicated staff / resources to provision EC2 instances, configure those EC2 instances, and manually deploy apps.

Scaling is simplified with Heroku. You can easily scale both vertically and horizontally by spinning up "dynos".

Heroku Cons:

Heroku is generally more expensive than AWS. This makes sense because of the additional level of abstraction a PaaS service like Heroku provides.

Heroku is also smaller than other competitors like AWS and Google.

Firebase

Google's Firebase is the new kid on the block. It's been around since 2011 and fits more into the PaaS realm like Heroku.

The interesting thing about Firebase is it completely abstracts away any server side concerns from your app development. If you're a front end developer, Firebase allows you to easily host and deploy your web app without having to write a single line of code server side.

Firebase provides "out-of-the-box" APIs for easy authentication with third party apps like Facebook and Twitter. It automatically configures SSL and managed your deployment with SEO in mind.

Being a Google product, Firebase also automatically wires up support for AdSense and Analytics. No need to configure these services through SDKs or code snippets.

Additionally, Firebase includes real time DB storage exposed through an easy to use API. It favors websockets over HTTP connections to sync your data in real time. This provides a huge advantage over alternatives where data is only available when you call for it with HTTP etc.

Firebase pricing:

Firebase pricing is based on 3 different tiers: Free, fixed pricing, and pay as you go...

Free Fixed ($25 / Month) Pay as you go 5 GB storage 50 GB storage $0.026 / GB storage 100 Realtime DB connections 100K Realtime DB connections 100K / DB connections

Firebase pricing is specific to the solutions that make Firebase what it is. Realtime database connections, user authentication, and hosting all fall into the black box that is Firebase infrastructure.

For complete pricing, be sure to check out the Firebase official pricing page.

Firebase pros:

Firebase is a front-end developer's dream come true. It allows you to plug into Google's "black box" without having to worry about server side implementation.

Firebase is probably the fastest way to host a proof of concept or MVP.

Firebase provides and automatically configures SSL, data storage, etc.

Firebase is backed by Google. This offers many benefits including access to SSD and CDN edge servers for fast global access to your app.

Firebase cons:

Firebase is severely limited in the visibility it provides into your system. Unlike AWS or Heroku, Firebase completely manages your backend infrastructure with the assumptions it makes about your app configuration. This creates "vendor lock in", making it very difficult to migrate your app to other platforms. Once you start with Firebase, you're stuck with Firebase.

What is the best web hosting option for you?

When should you use Firebase?

Use Firebase if you just graduated a 12 week coding boot camp and want to quickly prototype examples of your work for future employers. While Firebase makes things like authorization and real time data storage super convenient, it severely constrains you to Google's "black box".

For more advanced projects, Firebase may not be a good option. With that said, Firebase may be the preferred option for prototyping or UI intensive projects.

When should you use Heroku?

Heroku is a great option if you want the benefits of AWS infrastructure without the devops headaches of managing that infrastructure. If you are a small company without the resources for staffing devOps resources then Heroku is a great choice.

Remember that Heroku can easily scale. Additionally, the more professional plans allow for auto scaling and prorated usage, making Heroku extremely cost efficient for smaller operations looking to scale quickly.

When should you use AWS?

Use AWS if you have the resources available to procure and manage AWS instances. While Beanstalk is reducing the amount of maintenance required to manage AWS solutions, a certain level of oversight is still necessary for using AWS.

Remember that AWS can be the most cost-effective option if utilized correctly. The cost of maintaining and provisioning equipment can quickly offset the savings of cheaper hardware offered by AWS.

Conclusion

It's important to remember that Firebase, Heroku, and AWS are all backed by big tech companies. This means all 3 options will continue to evolve and compete with one another as the market's demands change over time.

While Firebase is Google's new kid on the block, Heroku is built on AWS and abstracts a lot of the devOps work away from managing AWS.

AWS may offer the most cost-efficient options but remember these are "a la carte" and require a certain level of maintenance not required with alternatives like Firebase or Heroku.