Spring Boot Microservices on AWS Elastic Kubernetes Services (EKS)
Binit Datta
Copyright 2021 by Binit Datta
Preface About the Book
The book will define what Containers are, how Kubernetes Container Orchestration achieves automation of running containerized applications on a massive scale. It will then show how to build Spring Boot Microservices and how to deploy that on an AWS Elastic Kubernetes Container Service (EKS). It will teach concepts behind Kubernetes Cluster, Pods, Services, and Networking. The Microservices are production-grade and not the type of Hello World APIs. Advanced Spring Boot Topics such as Aspect-Oriented Programming, Event Publishing, and Trapping will also be shown. Along the way, we will deal with AWS Elastic Container Registry, AWS eksctl command-line utility to provision an AWS EKS cluster, and AWS RDS MySQL.
Source Code
The source code for the book is available in the following two repositories
https://github.com/binitauthor/rollingstone-ecommerce-product-catalog-k8s-api
https://github.com/binitauthor/rollingstone-ecommerce-category-k8s-api
If and when you find any issues that you want to report, go to the following and create an issue and I will respond asap.
https://github.com/binitauthor/rollingstone-ecommerce-category-k8s-api/issues
https://github.com/binitauthor/rollingstone-ecommerce-product-catalog-k8s-api/issues
Note
- Please always treat the source code from GitHub as the source of truth, now the code from the book pages
- Please feel free to ask any Microservice Design/Migration/Monitoring and AWS/Azure Cloud related questions openly in the GitHub Issues and I will love to engage with you even if the questions are beyond the topics covered in this book. This is a huge topic and covering everything significant is not feasible in a 300 page book but we should still continue to discuss.
Table of Contents
3.1 Virtualization
4.1. Creating a New Project in IntelliJ
Building Product REST API to AWS EKS
About the Author
Binit Datta has over twenty-five years of in-depth experience in business computing. He is an Enterprise Architect at home with both business and technology professionals using the latest and most remarkable cutting-edge technologies. He draws heavily growing up in the 90s, where lack of job divisions helped him understand the depth of business requirements and then design, build, and implement systems all by himself and his colleagues. His decades old experience directly interacting with end customers and stakeholders of all stripes, eliminates the disadvantage of only knowing and focusing on technology alone without knowing the relevance of their application.
Binit has spent the last ten years architecting and leading technology teams building modern high traffic eCommerce websites and scalable enterprise APIs / applications for multiple fortune 50 companies in AWS and Azure Cloud environments. Continuing from his multiple comfort zones, he spearheaded in User Interface Feasibility, Usability and Architecture, and Microservices based REST API Architecture (CRUD and CQRS), Security-related discussions, Event-Driven Streaming Architectures, among others. While his AWS Cloud Certifications (AWS Solution Architect Professional) prove his Cloud credibilitys, he has led multiple real-life Cloud Migration Programs to enrich his Cloud experience.
Acknowledgements
I want to acknowledge the invaluable contribution hundreds of non-technical business users have made in shaping my thought process through the last 25 years. They have helped me believe that with all the great importance all kinds of technologies get today, they are still a means towards the common business goal at the end of the day. That mindset has helped me understand the significant similarity between competing platforms like Java and .NET, Spring Framework and Angular, Maven, Gradle, NuGet, NPM and Gulp, and the like.
I would also like to acknowledge the great effort made by Arupa in reviewing this entire book, trying the technical example independently to make sure they are accurate. Her support, silent inspiration, sacrificing weekends cannot be measured in measurable terms.
Lastly, I would like to acknowledge the rich contribution made by Mr. Biswajit Das, one of my earliest mentors. Mr. Das graduated from one of India's most prominent educational institutions, the Indian Institute of Technology, Kharagpur. Google CEO Sundar Pichai is also an alum of the same institution. Mr. Das is a Gold medalist from IIT, Kharagpur. Despite his stellar educational background, how he focused on the most humble business users/operators to the most important stakeholders alike made a deep impression on me that still motivates me to work for the users and apply the latest and greatest technology for them. The other thing that greatly validated and inspired my own passion for learning new technology relentlessly was seeing Mr. Das do the same as a number of high level positions (that could be non-technical) remained available.
Introduction
I am writing this book to be one in a series to aid rapid learning. Following are some my most critical objectives
- As millions of people across the world, joins the software engineering workforce every year, show them directly what works in high traffic application in production, rather than Hello World
- Add skills rapidly that non-technical customers are willing to pay for and use the skills as a competitive advantage for the reader
Let us take a casual look at the following diagram
The diagram above described most of the IT application development teams today. Applications are growing increasingly complex even though customers view them through their simple Browser-based (or Smartphone-based) User Interfaces. Tens of hundreds of new tools and technologies are added to the existing toolset to build applications, and we need to keep pace with that. In this scenario, the key is to learn something that works well in Production! Period. We do not have time for Hello World anymore. We may still use Hello World types, but we certainly would not stop there without showing how to elevate them to Production grade applications.
The idea of this book is to raise the level of our knowledge quickly to build high-grade production applications in Spring Boot Microservices deployed in real Amazon Web Service (AWS) Elastic Kubernetes Service (EKS) accessing an AWS RDS Database. This is the first book in a series as all topics cannot be covered within 300 odd pages. Information Technology in general and Software Engineering is specific is very much like a cooking Recipe. A world-famous Chef knows his/her ingredients deeply, when to use what quantities at what temperature etc. However, the same Chef is not famous for his/her knowledge of the ingredients. He/she is renowned for the resulting delicious taste of the combined usage of the components. Customers who eat his/her creation make him/her famous. Customers do not care about the ingredients but the result. Similarly, our customers care about the results, which is either the website or the mobile app or the batch jobs or the analytics platform. The books objective is to show us what to, how to, and when to use these ingredients to use a great testing (or functioning) complex Software using Spring Boot and AWS.
Caution for AWS Cost and Security
This book deals with several AWS paid services like EC2, EKS, Load Balancers, RDS, and others. One can use this book on a company-controlled AWS environment for the best results. If this book is used on a personal AWS account, take special care to protect your AWS Access and Secret Keys and not reveal them accidentally in public GitHub repositories. Also, do excellent planning, understand accurately, and try the AWS dependent applications in one block of time before deleting the environment. One can take days to keep the AWS environment alive, and the cost would not be too much. However, always make sure to terminate and delete the AWS services to control the cost.