Let’s begin our journey of learning Serverless computing. I am going to be using ProjectX as the moniker for it. So, whenever you see this word in title of blogpost, you will know this post is one in the series of posts helping you to start from Zero and become a Hero in the Serverless world
We will be focusing primarily on learning AWS Lambda. But as we move along, we will also learn about utilizing other AWS services to fulfill additional requirements in the realm of serverless computing.
In my opinion, Serverless computing is a natural evolution of the rapid progress we are making in Cloud computing. You can refer to my first blog  Serverless – more FinDev than DevOps by Yan Cui for more details.
Whether you think Serverless is going to be a big hit or a big miss, it will remain as one of the options for hosting your code in cloud. So, it is better to learn it to cover all bases of our knowledge in cloud.
Serverless & Microservices
One of the best implementations of Serverless computing is with Microservices-based architectures. So, lets aim to implement ProjectX as a bunch of Microservices.
Out of the box, AWS Lambda supports the following technologies natively
- .Net Core
Additionally, there is an option called Custom Runtime, which basically allows BYOT (i.e. Bring Your Own Technology). Using this option, you can host COBOL code in Lambda functions if you wanted.
So, the takeaway from this is, you are not confined to build on a single technology stack. You can choose a mix of many technologies to construct different Microservices as you please.
Also, Node.JS environment has native support for RESTful APIs and its module-based system helps in organizing code as independent micro-units which work well in isolation as well as can work together just as easily.
The other benefit of Node.js ecosystem is the choice you get of various specialized libraries and packages that are created for specific purposes. For example, to create API, you can use Hapi.js or any other packages you like. For implementing Promises, you can use standard “promises” package or various flavors of it. Hence you are not restricted to doing things in one single way and can make use of the best packages for your unique programming needs.
Sample Use case
So even though we will be embracing the Microservice architecture, we will require a sample use case for implementation. What will that be?
Jeff Bezos build the whole Amazon empire by selling books. So why not start with the same and who knows we may also get lucky.
So, our use case for building Serverless Microservices will be to start with a books catalog. We will extend it as per our needs later.
One final step before we start banging our keyboards to produce code, is to correctly setup the AWS configuration with Cloud9 IDE. So please follow the instructions below and complete the setup.
1: Setting up AWS account and permissions properly
It is AWS best-practice to Not work with root accounts. So, create an additional user called Administrator, give him AdministratorAccess permissions and enable Multi-factor authentication for this user.
You can start using this user for our project.
After the Administrator user is created successfully with right permissions, make sure to grab the following two details for this user
- Access key ID (e.g. AKI**********Z6Y)
- Secret access key (e.g. aKRaswe*****************5bhMWn)
2. Configure Cloud9 to use Administrator user
Click on AWS Cloud9 on top left of your screen then click Preferences and in the window that opens, scroll down to AWS Settings
Disable the option AWS managed temporary credentials, as shown below
Then right-click on C9.NodeJS folder, select Open Terminal Here option from Menu.
Type aws configure here
Enter the appropriate details as shown above and the setup is done.
With that you are all set to begin development in Serverless world. So, Operation ProjectX commences from next blog post.
Stay tuned and Happy Clouding!