Skip to main content

How to create an Auto Scaling group - Load Balancer with a domain name managed from route53 - AWS

Let's assumed you have requested your ACM, so in other words, you've got already your SSL for your domain name and you've got the domain name ready too with Route53.

Let's start deploying an EC2 instance and let it ready with the microservices and frontend we need, for the purpose of this example the instance was set it up with a Centos7 with a service which autostarts the backend Java services and with Nginx as the one is going to be running the front end plus a Reverse Proxy. once you've restarted that instance and it starts without any trouble starting up the whole services, so let's create an Image of that instance.

we are going to be

1  Creating a Classic load balancer
2: Creating a Launch Template
3: Creating an Auto Scaling Group

 let's start creating a classic load balancer 



Select your security group 

Choose your certificate from ACM, for this purpose that process was done before about requesting the ACM certificate


Now pay attention to step 5, we have not selected in there any instance to start with, so that it is going to be managed with an Auto Scale group starting from a launch template


After you have created the load balancer, you've got to make an alias from the domain name to the Load Balancer, so go to Route53 - DNS Management  - Hosted zones and select your domain name, click on Create Record Set, click on Alias YES, click on Alias Target and pick up the Load Balancer name you gave and click on Create


now the domain name is pointing to the Load Balancer

now let's go to AUTO SCALING  - Launch Configurations and click on My AMIs and select the AMI I create before 




I have chosen a t2.micro for the purpose of the example


I have chosen Create Auto Scaling Group after the Launch template was created, the path to go there is EC2 - AUTO SCALING - Launch Configurations, just select your template and create the auto-scaling group in there


I have given a name to the AutoScaling group, I have added the subnets, and pay attention to the one important thing, I have clicked on Receive traffic from one or more load balancers, so when I did that it immediately allowed me to attach the available load balancers to it, the Health Check Grace Period is by default 300 seconds, I changed by 150







in some seconds you will see the instances being deployed on the EC2 - Instances
making this short if you delete one instance of the maximum instance, it will automatically start a new one, if the instances are getting to the average CPU utilization, it will start a new instance automatically and if the instances are not being used, it starts turning down the instances.


Java Api and Frontend to test it 

Comments

Popular posts from this blog

How to deploy a VueJS App using Nginx on Ubuntu

There are thousands of blogs and websites out there explaining how to do a hello world and how to start with VueJS, but in this little post, I’m just going to be explaining how to do deploy a VueJs app after you have run the command through the CLI npm run build . So when you run the command npm run build a dist folder is created and that folder’s got the essential .js files to run our app, when we want to run our app on an Nginx server by default the vue-router is not going to work well so that Nginx does not come ready to work by default with a VueJs app This is basically for a Linux Ubuntu distribution if you’ve got any other Linux distribution just pay attention where is going to be set the www/html folder and the Nginx settings so that this is useful for any Linux distribution  Install and configure nginx sudo apt install nginx Double check to make sure the nginx service is running with command service nginx status, then open your browser and enter ...

Nginx reverse proxy for ReactJS, Vuejs,Laravel and Django with or without Docker

Nginx is an important piece on the working chain apps so that it works as bridge between the end user and the application servers, to do that we will be using nginx as a reverse proxy to know more in deep about nginx reverse proxy go to https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/ let's suppose you have a domain name called yourdomainame.com Nginx - ReactJS/Vuejs each time you need to create a new domain name, set it on the path /etc/nginx/conf.d/ create a file with vim or nano or whatever you want, and give it the domain name .conf and set the settings on it, this is really useful when you start handling several domain names under the same server vim /etc/nginx/conf.d/ yourdomainame.com.conf server {         server_name   yourdomainame.com wwww.yourdomainame.com;         # Load configuration files for the default server block.         include /etc/nginx/default.d/ *.conf ;   ...

How to use an SSL certificate for both the API using SpringBoot and for the FontEnd using VueJS or ReactJS

In the previous post  https://springboot-vuejs-reactjs.blogspot.com/2019/07/how-to-secure-springboot-with-ssl-and.html , we were doing the steps to get and install a certificate SSL for an apache tomcat embedded using SpringBoot , and we learned we can have as many SpringBoot applications secured with SSL as we want on the same server using the same   .p12  /  PKCS #12 file, so now we are going to be reviewing about how we can use the same certificate for apache tomcat and for an Nginx server at the same time. we were working on the folder /root/SSL the last generated file was the  apitester.p12 a  PKCS #12  file to work with Nginx with need two files a .crt and .key file and as we started the process securing apache tomcat we do not have those files but we get them using a converter through this webpage: https://decoder.link/converter let's chose the option PKCS#12 TO PEM an let's download the  apitester.p12 from the remote serv...