Book Image

Hands-On Serverless Applications with Kotlin

By : Hardik Trivedi, Ameya Kulkarni
Book Image

Hands-On Serverless Applications with Kotlin

By: Hardik Trivedi, Ameya Kulkarni

Overview of this book

Serverless is a cloud computing execution model where the cloud provider dynamically manages the allocation and provisioning of servers. Many companies now use serverless architectures to cut costs and improve scalability. Thanks to its concise and expressive syntax and a smooth learning curve, Kotlin is a great fit for developing serverless applications. With this book, you’ll be able to put your knowledge to work by implementing serverless technology in your applications and become productive in no time. Complete with detailed explanation of essential concepts and examples, this book will help you understand the serverless architecture fundamentals and how to design serverless architectures for your applications. You’ll also explore how AWS Lambda functions work. The book will guide you in designing, building, securing, and deploying your application to production, along with implementing non-functional requirements such as auditing and logging. Furthermore, you’ll discover how to scale up and orchestrate serverless applications using an open source framework and handle distributed serverless systems in production. By the end of the book, you’ll be able to build scalable and cost-efficient Kotlin applications with a serverless framework.
Table of Contents (11 chapters)
3
Designing a Kotlin Serverless Application

Practical walk–through

Now that we have seen the best practices and pointers for covering the security aspects of a system, let's do a hands-on exercise to implement the security in the Greeter API that we created in Chapter 2, AWS Serverless Offerings.

To do this, we need to create a test bed by extending the current scope of the Greeter lambda function to talk to the RDS instance and execute a simple database query. With this set up, we have a simplified version of the actual LetsPoll APIs that can be looked at cross-sectionally.

The setup is as follows:

  • API Gateway calls out to the Greeter lambda function
  • The Greeter lambda function makes a DB call
  • The database credentials are hardcoded in the lambda function
  • The PostgresDB has a master user
  • The Postgres RDS DB is in a public subnet
...