Creating a instance template with tomcat application
- Lets create a image with tomcat application
- Create a ubuntu 18.04 instance and execute the following commands
sudo apt update
sudo apt install openjdk-8-jdk -y
sudo apt install tomcat8 tomcat8-admin tomcat8-common tomcat8-docs tomcat8-user -y
cd /tmp
wget https://referenceappkhaja.s3-us-west-2.amazonaws.com/gameoflife.war
sudo cp /tmp/gameoflife.war /var/lib/tomcat8/webapps/gameoflife.war
- Now access the application htpp://publicip:8080/gameoflife
- Now lets try to create a image
- Once the image is created , lets create an instance template
- Ensure you have healthcheck created
- From instance template try to create instance group with minimum 2 instance and max 5 instances
- Wait for the instance template to be launched and the health checks to be successful
- Lets create a loadbalancer with http protocol
- frontend => http port 80
- backend => game of life group http port 8080
Exercise:
- Try to create instance template in such a way that your instances will not have public/external ip address
- Then create a load balancer
- This is given as an exercise as in reality we will not create our vms with external ips which are part of instance-group and running our production applications.
Summary
- We have been creating instance templates and instance groups from google console
- We need to find the automation options around it