Deploy Java Spring Boot Applications to AWS, Azure, GCP with Docker and Kubernetes

blog details
author Ranga Karanam January 03, 2022 12 minutes

Image

In this article, we focus our attention on the cloud. Why do we need the cloud? And how can you learn the cloud?

You will learn

  • What is Cloud?
  • Why do we need the Cloud?
  • What are the popular cloud providers?
  • What is IAAS and PAAS?
  • What is Docker?
  • What is Kubernetes?
  • What are the PAAS offerings provided by AWS, Azure and GCP?
  • How can you learn about the cloud?

Introduction

You want to learn about the cloud. But you don’t know where to start.

One of the best option to learn the cloud is to deploy some of the applications that you have developed to different cloud providers.

When we talk about the Java Spring Boot world, typically we talk about

  • Web Applications
  • REST APIs
  • Microservices
  • Full Stack Applications

How about deploying these applications to different cloud platforms?

That’s the kind of courses that we would be talking about in the article.

Introduction to Cloud

Let’s start with understanding why we need the cloud.

Why do we need the cloud?

The three reasons are

  • On Demand Resource Provisioning
  • Avoid “Undifferentiated Heavy Lifting”
  • Improved Latency and Availability

On Demand Resource Provisioning

If you are amazon or a startup, the load on your application varies a lot during the year. Load during peak season like holidays might 2-10 times the regular load. If you provision infrastructure in your data center for peak load, then what would it be doing during the rest of year? Sitting Idle!

That’s the problem cloud solves!

You can provision and release resources on demand.

Avoid “Undifferentiated Heavy Lifting”

What is the focus of a business?

To create amazing solutions and provide great service to their customers.

If business focus on automation, tools and infrastructure, the focus shifts from their core job.

Why not leave the “Undifferentiated Heavy Lifting” to the cloud providers?

Improved Latency and Availability

Each of the cloud providers have multiple data centers available in multiple continents and multiple countries.

It would be difficult for businesses to set up such wide spread infrastructure.

However, to have high availability and low latency for end users, you would need to have multiple deployments around the world.

Cloud Providers make it easy for you to have multiple deployments of your application across the world.

IAAS vs PAAS

Now, you want to go the cloud. You have an important choice to make.

Do you want to deploy your applications the same way you deploying while using your data center or do you want to use facilities provided by your cloud provider?

For example, if you are using AWS (Amazon Web Services), you have two options

  • Approach 1 - You can create virtual servers (EC2 - Elastic Compute Cloud) and deploy your applications to the virtual servers.
  • Approach 2 - You can use a service provided by AWS - for example, AWS Elastic Beanstalk - to deploy your application and not worry about the virtual servers.

Approach 1 is typically called IAAS - Infrastructure as a Service. You are getting the infrastructure from the cloud provider and deploying the applications the usual way you do. The cloud provider is responsible only for providing the virtual servers. You are responsible for installing OS, OS Upgrades, Installing Runtime, Runtime upgrades and everything that goes along with them.

Different clouds provide different IAAS Services. The virtual servers are also called differently in different clouds

  • AWS calls them EC2 (Elastic Compute Cloud)
  • Azure Virtual Machines
  • Google Compute Engines

Approach 2 is called PAAS - Platform as a Service. You are only responsible for your application deployable unit. The cloud provider is responsible for Platform Upgrades, Runtime Upgrades and OS Upgrades.

PAAS Examples are Managed Services provided by different cloud providers. A good examples are the database management services provided.

  • AWS provides RDS - Relational Database Service
  • Azure provides DB for MySQL

Great thing about these managed services is that the cloud provider would take care of most non functional requirements.

  • Reliability
  • Availability
  • Backups

Platform as a Service in Depth

If we look at PAAS in depth, there are a number of application PAAS services offered by different cloud providers

  • AWS Elastic Beanstalk
  • Google App Engine
  • Azure Web Apps

These services make it easy to deploy Java applications, Containers and a wide variety of applications to the cloud.

These PAAS offering come with Support for

  • Multiple Environments
  • Multiple Platforms and Language Support
  • Container and Multi Container Support
  • Deployment Strategies - Blue Green Deployment
  • Auto Scaling
  • Load Balancing
  • CI/CD (AWS Code Pipeline, AWS Code Build, Azure DevOps, Google Cloud Build)

Cloud Specific Container Orchestration Solutions

One of the important developments of the last few years is the evolution of containers as a platform neutral, language neutral deployment options.

Cloud providers provide PAAS options around containers and container orchestration. The most important offerings are

  • AWS Fargate or ECS (Elastic Container Service)
  • Azure Container Instance - Azure is actually moving towards AKS (Azure Kubernetes Service)

Cloud Neutral Kubernetes Based Container Orchestration Solutions

Other important evolution of last few years is the evolution of Kubernetes as the Cloud Neutral Container Orchestration Service.

Each of the cloud providers provide Container Orchestration Solution around Kubernetes.

  • GKE (Google Kubernetes Engine)
  • AKS (Azure Kubernetes Service)
  • EKS (AWS Container Services for Kubernetes)

Spring Boot to AWS, Azure, GCP, Docker and Kubernetes

Here are some of the amazing courses that help you learn cloud, containers and orchestration by deploying a variety of Spring Boot applications to the cloud.

Docker for Java Developers - with Spring Boot Microservices

Docker is the No 1 Tool to Containerize your Java Spring Boot Applications. Learning Docker would help you streamline your deployment processes and experiment easily with new frameworks and tools.

The first course we are going to talk about is “Docker for Java Developers - with Spring Boot Microservices”.

Image

In this hands-on course, you will containerize - create docker images and create containers - a variety of Spring Boot Applications:

  • REST APIs - Hello World and Todo - Jar
  • Todo Web Application War
  • Full Stack Application with React and Spring Boot
  • CCS and CES Microservices
  • Eureka Naming Server and Zuul API Gateway

This course would be a perfect first step as an introduction to Docker.

You will Learn Docker Architecture and the Fundamentals of Docker - Registry, Repository, Tag, Image, Container and Volumes and also learn the important Docker commands.

You will learn to use Dockerfile to Automate Building of your Docker Image and also use various maven plugins - Dockerfile Spotify Plugin, JIB Plugin and Fabric8 Docker Maven Plugin - to create Docker images. You will also learn to follow the best practices with creating Docker Images - Improve Caching of Docker Images and create Multi Stage Docker Builds.

Learn AWS - Deploy Java Spring Boot to AWS Elastic Beanstalk

AWS is the most popular cloud and AWS Elastic Beanstalk makes it easy to deploy a variety of applications to AWS.

“Learn AWS - Deploy Java Spring Boot to AWS Elastic Beanstalk” is another amazing hands-on course on AWS to help you deploy Spring Boot applications to AWS.

Image

In this course, you will learn to deploy a variety of Spring Boot Applications to the Cloud:

  • REST APIs - Hello World and Todo - Jar
  • Todo Web Application War
  • Full Stack Application with React and Spring Boot
  • Single Container with Java REST API
  • Multi Container with Todo REST API talking to MySQL

This course would be a perfect first step as an introduction to AWS and the Cloud, especially for Java Developers.

You will learn about automating deployments with Elastic Beanstalk CLI and creating a continuous delivery pipeline with AWS Code Pipeline. You will learn how to Auto Scale applications based on load as well as deploy multiple instances behind a load balancer using Elastic Beanstalk.

You will be using a number of AWS Services - EC2, S3, AWS CodePipeLine, AWS CodeBuild, SQS, IAM, CloudWatch.

Master AWS Fargate & ECS with Java Spring Boot Microservices

We learnt about docker earlier. AWS Elastic Container Service and AWS Fargate are the container orchestration services provided by AWS.

“Master AWS Fargate & ECS with Java Spring Boot Microservices” is another awesome course to help you learn AWS and container orchestration.

Image

This course would be a perfect first step as an introduction to Amazon Web Services - AWS and the Cloud.

In this course, you will deploy a variety of Java Spring Boot Microservices to Amazon Web Services using AWS Fargate and ECS - Elastic Container Service.

You will learn the basics of implementing Container Orchestration with ECS (Elastic Container Service) - Cluster, Task Definitions, Tasks, Containers and Services. You will learn about the two launch types of ECS - EC2 and AWS Fargate. In this course, we would focus extensively on AWS Fargate to simplify your Container Orchestration. You will learn to deploy multiple containers in the same ECS task.

You will learn to Build Container Images for your Java Spring Boot Microservice Projects.

You will implement the following features for your Microservices

  • Centralized Configuration Management with AWS Parameter Store
  • Distributed Tracing with AWS X Ray
  • Auto Scaling and Load Balancing with ECS, Elastic Load Balancers and Target Groups
  • Service Mesh using AWS App Mesh. You will learn the basics of AWS App Mesh - Mesh, Virtual Nodes and Virtual Services. You will learn to perform Canary Deployments using AWS AppMesh.
  • Service Discovery with Route 53 Hosted Zones and DNS.
  • Continuous Integration and Continuous Deployment with AWS Code Pipeline

You will learn to debug problems with deploying containers using Service events and AWS CloudWatch logs.

You will learn about automating deployments and creating a continuous delivery pipeline with AWS Code Pipeline. You will learn how to Auto Scale applications based on load as well as deploy multiple instances behind a load balancer using AWS ECS Fargate.

You will be using a number of AWS Services - ECS - Elastic Container Services, AWS Fargate, EC2 - Elastic Compute Cloud, S3, AWS CodePipeLine, AWS CodeBuild, IAM, CloudWatch, ELB, Target Groups, X Ray, AWS Parameter Store, AWS App Mesh and Route 53.

Master Pivotal Cloud Foundry with Spring Boot Microservices

Pivotal Cloud Foundry (PCF) provides a great cloud-native platform to deploy Spring Boot Applications.

Master Pivotal Cloud Foundry with Spring Boot Microservices is a great course to learn about PCF and get a feel for how you deploy application to Cloud using PCF.

Image

In this course, you will learn the basics of Pivotal Cloud Foundry by deploying several full featured Spring Boot applications to PCF. You will deploy a REST API, a web application, a full stack application built using Spring Boot and React. You will learn to deploy Java Spring Boot applications containerized using Docker to PCF.

This course also focuses on help you deploy amazing Spring Boot microservices to PCF using several Spring Cloud Services like Service Registry, Config Server and Hystrix.

You will learn how to Auto Scale applications based on load as well as deploy multiple instances behind a load balancer using Pivotal Cloud Foundry.

This course would be a perfect first step as an introduction to PCF and the Cloud.

Master Azure Web Apps - Take Java Spring Boot Apps to Azure

Microsoft Azure is the second most popular cloud platform today. Azure Web App is a PAAS offering from Azure to help you deploy applications easily to the Cloud.

Master Azure Web Apps - Take Java Spring Boot Apps to Azure is an amazing course to help you get started with Azure.

Image

In this course, you will deploy a variety of Spring Boot Applications to the Cloud:

  • REST APIs - Hello World and Todo - Jar
  • Todo Web Application War
  • Full Stack Application with React and Spring Boot
  • Single Container with Java REST API
  • Multi Container with Todo REST API talking to MySQL

This course would be a perfect first step as an introduction to Azure and the Cloud, especially for Java Developers.

You will learn about automating deployments with Azure and creating a continuous delivery pipeline with Azure DevOps. You will learn how to Auto Scale applications based on load as well as deploy multiple instances behind a load balancer using Azure App Service.

You will be using a number of Azure Services - Azure App Service, Azure Web Apps, Azure DevOps, Azure Database for MySQL Services, Resource Groups, Azure App Service Plans, and Azure Subscriptions.

Kubernetes Crash Course for Java Developers on Google Cloud

Kubernetes makes it easy to manage clusters with 1000’s of containers running 1000’s of microservices. Google Kubernetes Engine (GKE) makes it super easy to create Kubernetes Clusters.

How about getting them all together and deploying Spring Boot Microservices to Kubernetes Clusters created on Google Cloud Platform using Google Kubernetes Engine (GKE)?

Kubernetes Crash Course for Java Developers on Google Cloud is an amazing course to help you get started with Kubernetes.

Image

In this hands-on course, you will use Docker and Kubernetes to deploy a variety of Spring Boot Applications on Google Cloud using Google Kubernetes Engine:

  • REST APIs - Hello World
  • Todo Web Application War
  • Spring Boot Microservices

You will implement Service Discovery, Centralized Configuration, Distributed Tracing and Load Balancing for Spring Boot Microservices deployed in Kubernetes Clusters.

You will learn to use Helm Charts, Istio Service Mesh, Google Stackdriver, and Spring Cloud Kubernetes to play with Spring Boot Java Microservices on Kubernetes.

This course would be a perfect first step as an introduction to Kubernetes.

Just Released