Serverless computing, also closely associated with Functions-as-a-Service (FaaS), is defined by stateless compute containers and modeled for an event-driven solution.
FaaS provides a platform allowing the developers to execute code in response to events without the complexity of building and maintaining the infrastructure. The third-party apps or services would manage the server-side logic and state.
A serverless solution explained in the blog "Serverless Architecture-The Future of Business Computing" consists of a web server, FaaS layer, security token service (STS), user authentication, and database.
- Web server: Amazon S3 provides a robust and simple web server. All of the static HTML, CSS and js files for your application can be served from S3.
- FaaS solution: It is the key enabler in serverless architecture. Some popular examples of FaaS are AWS Lambda, Google Cloud Functions, and Microsoft Azure Functions. AWS Lambda is used in this framework. The application services for logging in and accessing data will be built as Lambda functions. These functions will read and write from your database and provide JSON responses.
- Security Token Service (STS): This will generate temporary AWS credentials (API key and secret key) for users of the application. These temporary credentials are used by the client application to invoke the AWS API (and thus invoke Lambda).
- User authentication: AWS Cognito is an identity service which is integrated with AWS Lambda. With Amazon Cognito, you can easily add user Sign-up and sign-in to your mobile and web apps. It also has the options to authenticate users through social identity providers such as Facebook, Twitter, or Amazon, with SAML identity solutions, or by using your own identity system.
- Database: AWS DynamoDB provides a fully managed NoSQL database. DynamoDB is not essential for a serverless application but is used as an example here.
For a detailed implementation of this architecture, you can visit the blog Serverless Architectures using AWS Lambda by Tony Fendall. He has comprehensively explained all the elements of the system with a cost breakdown and links to some demos.
Organizations that are already invested in cloud technologies will become the early adopters of serverless computing. Some of the future applications of serverless technology are Blockchain, IoT, gaming, and enterprise middleware. It inherently provides benefits of low operational cost, scaling, and less time to market. This technology has potential to become the foundational pieces of modern distributed systems. But as described in my previous post on 'The Drawbacks of Serverless Architecture', adopting serverless systems should take into consideration the over-reliance on third-party APIs and architectural complexity.