Getting Started with Amazon Web Services in Node.js

Introduction

Amazon Web Services (AWS) is a cloud computing provider with a number of extremely popular services. Ever since their launch back in 2006, they've become a key player in the development and deployment of major enterprise applications. Their services are scalable, flexible, and groundbreaking in many aspects, while keeping the cost relatively low compared to self-hosting.

These are just some of the reasons why major companies like Adobe, Airbnb, Autodesk, BMW, the European Space Agency, Ticketmaster, Xiaomi, Twitch, Netflix, Facebook, LinkedIn, Twitter, etc. started hosting their applications on the AWS platform..

We've compiled a series of articles on integrating with these services using Node.js in order to help you get up to speed with some of AWS's most popular services.

File Storage

AWS Simple Storage Service (S3)

Much of the software and web apps we build today requires some kind of hosting for files - images, invoices, audio files, etc. The traditional way to store files was just to just save them on the server's HDD.

However, saving files onto the HDD of the server comes with limitations, such as not being able to scale up, being required to allocate space before using it, and much higher pricing. Not to mention, requesting a huge amount of large files, like images for example, can really put a strain on the server.

To offload the servers, developers started hosting files with could storage providers such as AWS S3, Google Cloud Storage, etc.

In this article we will show you how to write Node.js code to upload files to S3:

Messaging Support

AWS Simple Notification Service (SNS)

AWS Simple Notification Service (SNS) is a super scalable service that allows users to implement the publish/subscribe model with ease.

This allows us to send texts, emails, push notifications, or other automated messages to other targets across multiple channels at the same time.

In this post, you'll learn how to build a web app that can publish a message to multiple subscribers at once via email, all using SNS:

AWS Simple Queue Service (SQS)

With the increased complexity of modern software systems came the need to break up systems that had outgrown their initial size. This increase in the complexity of systems made it harder to maintain, update, and upgrade them.

This paved the way for microservices that allowed massive monolithic systems to be broken down into smaller services that are loosely coupled but interact to deliver the total functionality of the initial monolithic solution. The loose coupling provides agility and eases the process of maintenance and the addition of new features without having to modify entire systems.

It is in these microservice architectures that Queueing Systems come in handy to facilitate the communication between separate services that make up the entire application.

In this post, we will dive into queueing systems, particularly Amazon's Simple Queue Service (SQS) and demonstrate how we can leverage its features in a microservice environment:

Database Support

AWS Relational Database Service (RDS)

It's not an overstatement anymore to say that information and data runs the world. Almost any application, from social media and e-commerce websites, to simple time tracker and drawing apps, relies on the very basic and fundamental task of storing and retrieving data in order to run as expected.

Amazon's Relational Database Service (RDS) provides an easy way to get a database set up in the cloud using any of a wide range of relational database technologies.

In this article, you'll learn how to set up a database on RDS and store data in it with a Node web application:

Cloud Computing

AWS Elastic Compute Cloud (EC2)

Once you've written a web application, there are dozens of offerings to get your app online and usable by other people. One well-known offering, and the most popular service on AWS, is Elastic Compute Cloud (EC2).

EC2 is a core part of AWS, and a lot of AWS's other services are built on top of it - therefore it's good to get an understanding of what EC2 is and how to deploy your application to it.

In this tutorial, we're going to create a basic Node.js app with Docker, start and configure an EC2 instance, and deploy our app to it:

AWS Lambda

The family of computing architecture that AWS Lambda belongs to is called Serverless Computing, or sometimes Function as a Service. It's groundbreaking for developers because there is no need to maintain servers. Every time an AWS Lambda function is created and run, a container is spun up to serve it, which is shared among other containers to keep utilization of resources high.

The code is deployed into the container and then executed. Hence making every subsequent request faster because AWS is skipping the initial creation of the container if it already exists.

In this article you'll learn more about the Lambda service and how to get your code up and running: