Book Image

Hands-On Serverless Applications with Go

By : Mohamed Labouardy
Book Image

Hands-On Serverless Applications with Go

By: Mohamed Labouardy

Overview of this book

Serverless architecture is popular in the tech community due to AWS Lambda. Go is simple to learn, straightforward to work with, and easy to read for other developers; and now it's been heralded as a supported language for AWS Lambda. This book is your optimal guide to designing a Go serverless application and deploying it to Lambda. This book starts with a quick introduction to the world of serverless architecture and its benefits, and then delves into AWS Lambda using practical examples. You'll then learn how to design and build a production-ready application in Go using AWS serverless services with zero upfront infrastructure investment. The book will help you learn how to scale up serverless applications and handle distributed serverless systems in production. You will also learn how to log and test your application. Along the way, you'll also discover how to set up a CI/CD pipeline to automate the deployment process of your Lambda functions. Moreover, you'll learn how to troubleshoot and monitor your apps in near real-time with services such as AWS CloudWatch and X-ray. This book will also teach you how to secure the access with AWS Cognito. By the end of this book, you will have mastered designing, building, and deploying a Go serverless application.
Table of Contents (17 chapters)

What this book covers

Chapter 1, Go Serverless, gives a foundational explanation of what serverless is, how it works, whats its features are, why AWS Lambda pioneered serverless compute offerings, and why you should use Go for building serverless applications.

Chapter 2, Getting Started with AWS Lambda, supplies guidelines for setting up an AWS environment alongside the Go runtime and development environment.

Chapter 3, Developing a Serverless Function with Lambda, describes how to write your first Go-based Lambda function from scratch and how to invoke it manually from the console.

Chapter 4, Setting Up API Endpoints with API Gateway, illustrates how to trigger your Lambda function in response to incoming HTTP requests with API Gateway and build a unified event-driven RESTful API backed with serverless functions.

Chapter 5, Managing Data Persistence with DynamoDB, shows how to resolve Lambda functions stateless issue by using a DynamoDB datastore to manage data.

Chapter 6, Deploying Your Serverless Application, presents advanced AWS CLI commands and options that you can use while building serverless functions in AWS Lambda to save time. It also shows how to create and maintain multiple versions and releases of Lambda functions.

Chapter 7, Implementing a CI/CD Pipeline, shows how to set up a Continuous Integration and Continuous Deployment pipeline to automate the deployment process of Lambda functions from end to end.

Chapter 8, Scaling Up Your Application, covers how autoscaling works, how Lambda can handle traffic demands during peak service usage with no capacity planning or scheduled scaling, and how you can throttle and limit the number of executions using concurrency reservation.

Chapter 9, Building the Frontend with S3, illustrates how to build a single-page application with a REST backend backed by serverless functions.

Chapter 10, Testing Your Serverless Application, shows how test the serverless application locally using the AWS Serverless Application Model. It also covers Go unit testing and performance testing with third-party tools and shows how Lambda can be used to perform test harness.

Chapter 11, Monitoring and Troubleshooting, goes a step further in order to show you how to set up function-level monitoring with CloudWatch and how to debug and troubleshoot Lambda functions with AWS X-Ray to profile the application for abnormal behavior detection.

Chapter 12, Securing Your Serverless Application, is dedicated to the best practices and recommendations to follow in AWS Lambda to make your application resilient and secure according to the AWS Well-Architected Framework.

Chapter 13, Designing Cost-Effective Applications, covers also some tips for optimizing and reducing your serverless application billing and how to track the Lambda cost and usage with real-time alerts, before this becomes an issue.

Chapter 14, Infrastructure as Code, introduces tools such as Terraform and SAM to help you design and deploy your N-Tier serverless application in automated way, in order to avoid human errors and repeatable tasks.