Build a scalable and fault tolerance application — Part 3 — Deploy app to AWS
In the last post we added some business logic in the application and modify the user interface. At this moment we are ready to deploy the application in AWS using EKS (Elastic Container Service for Kubernetes) product.
Before to start the next steps, be sure that each microservice has the .yo-rc.json file generated by JHipster.
In the parent directory of all the microservices create a new directory call k8s (abbreviation for kubernetes) and navigate into it.
mkdir k8s && cd k8s
Generate Kubernates configuration
To generate all Kubernates files for the deployment you can use the JHipster Kubernates command
jhipster kubernetes
and follow the next steps.


The generator will ask you a few questions and choos the answears and highlighted above. For the Docker repository name provide your own DockerHub account id, if you don’t have a DockerHub account you can create one at this link address.
Now we have to push the application Docker images in the DockerHub account with the next commands.
docker image tag gateway <DockerHub account id>/gateway
docker push <DockerHub account id>/gatewaydocker image tag posts <DockerHub account id>/posts
docker push <DockerHub account id>/postsdocker image tag statistics <DockerHub account id>/statistics
docker push <DockerHub account id>/statisticsdocker image tag users <DockerHub account id>/users
docker push <DockerHub account id>/users
Preparing AWS EKS
Now that our application is pushed to DockerHub we can start to deploy it to AWS EKS. But before that let’s make sure we have all the prerequisites ready. You’ll need the next tools:
- kubectl: The command line tool to interact with Kubernetes. Install and configure it.
- AWS CLI: Install the Latest AWS Command Line Interface
- eksctl: a CLI for Amazon EKS. Install and read this tutorial on how to get started.
Configure AWS EKS
Eksctl and AWS CLI require your AWS credentials. You could do that by running the next command in a terminal and follow the steps.
aws configure
Now the credentials are set let’s configure Kubernates cluster.
First let’s create the cluster. Run bellow command which will create a cluster named travelingCluster.
eksctl create cluster — name travelingCluster
After the creation of the cluster you could check if you can connect to the cluster with the next commnad.
kubectl get nodes
Deploy the application to AWS EKS
Now that the cluster is ready we can start the last step, to deploy the application to AWS EKS. To do this we have to navigate back to the k8s directory, created at the beginning of this article and run the bellow commands in the same order.
kubectl apply -f registry-k8s/kubectl apply -f gateway-k8s/kubectl apply -f posts-k8s/kubectl apply -f statistics-k8s/kubectl apply -f users-k8s/kubectl apply -f messagebroker-k8s/kubectl apply -f monitoring-k8s/jhipster-prometheus-crd.ymlkubectl apply -f monitoring-k8s/jhipster-prometheus-cr.ymlkubectl apply -f monitoring-k8s/jhipster-grafana.ymlkubectl apply -f monitoring-k8s/jhipster-grafana-dashboard.yml
Or you could also run the kubectl-apply.sh
script generated by JHipster.
To check if the application is up and running run kubectl get pods
to see the status of the containers. Wait until all the containers are in Running status.
Once the containers are running we can run the next command in the terminal
kubectl get service gateway
to get the external IP for the application. Open your favorite browser and paste the IP addres and you should see our wonderful application deployed.