Monday, April 12, 2021

Git ignore all files of a certain type except in all subdirectories of a certain directory?


# Package Files #
*.jar
*.war
*.nar
*.ear
*.tar.gz
*.rar


#Exceptions to File Types based on Locations
!LB/**/*.jar

Multiple Instances, LoadBalancer, @LoadBalanced

@LoadBalanced

import org.springframework.cloud.client.loadbalancer.LoadBalanced;

Why We place @LoadBalanced on RestTemplate because RestTemplate is used to to fetch Server IP Address and port from Eureka Registry and its also used for Client side Load Balancing


@EnableEurekaClient
public class MovieCatalogServiceApplication {

    public static void main(String[] args) {
        SpringApplication.run(MovieCatalogServiceApplication.class, args);
    }

    @Bean
    @LoadBalanced
    public RestTemplate getRestTemplate() {
        return new RestTemplate();
    }
}
See , In , Image Below, How Multiple Instances are registered of same application
We achieved by running application in an executable Jar in separate port

java -Dserver.port=8084 -jar movie-info-service-0.0.1-SNAPSHOT.jar


IntelliJ - Multiple Maven Projects Back into 1 Single Workspace/Window

How to merge Multiple Maven Projects Back into 1 Single Workspace/Window

https://stackoverflow.com/questions/8774024/intellij-working-on-multiple-projects/14637761#14637761


View > Tool Windows > Maven > An inline Window Opens > Click on Plus(+) Sign > Choose POM File of the Project You want to add in Workspace/Window > OK


Sunday, April 11, 2021

Install Ubuntu 17 on Virtualbox - With Full Desktop Screem

Newer Ubuntu versions gave me some issues - Got Stuck for 2-3 Hours

Solution : 

  • Don't Select "Download Updates" and "3rd Party Software" When U Click on Install Ubuntu


Download VirtualBox
https://www.virtualbox.org/wiki/Downloads


Download Ubuntu


How to Make Ubuntu Full Desktop
https://superuser.com/questions/751831/virtualbox-ubuntu-full-screen-mode-resolution/754029#754029
https://developerslogblog.wordpress.com/2019/02/12/how-to-run-virtualbox-in-full-screen-mode-in-linux/

Saturday, April 10, 2021

AWS VPC Peering

https://www.youtube.com/watch?v=w-5lSvqSkjs&t=0s

AWS : Internet <-> Internet GW <-> VPC <-> Route Table <-> NACL <-> Security Group <-> EC2 Instance

 Data Flow inside AWS

Internet  :  Internet GW <-> VPC <-> Route Table   <->  NACL  <-> Security Group <-> EC2 Instance


VPC

Route Table : Once Data Arrives at Subnet, RT attached to Subnet decides where to route data traffic , It cannot block/unblock, it can just route
Data Traffic may want to come to My Subnet
Data Traffic may want to go from Subnet to Other Subnet or May want to Go to Outside World
Route to Local or Route to IGW or Route to NAT Gateway.
0.0.0.0.0 : Traffic meant for "NOT VPC Subnet"  -> Route to IGW or NAT
p.q.r.s/16  : "Subnet Traffic " -> Route Locally to Subnet

NACL : Once Data Traffic arrives at Subnet
It has to cross N/W Firewall - Subnet Firewall - known as NACL which may allow it or block it.
It checks Protocol Type, Port, Source/Destination (depending on Incoming/Outgoing Direction) and then allows or blocks, The rules are Numbered, If a Match is found, It can be DENY or ALLOW Rule and no further rules are processed.
Its stateless, You have to configure separate rule for incoming and outgoing and they both are independent of each other

Security Group :
Determines the traffic that can reach/leave your instance.
It is stateful 
It has Incoming and Outgoing Rules
But Incoming is related to Outgoing 
It has no DENY/ALLOW rule flag
All Rules are ALLOW by default
Rule says 
->  Allow PROTOCOL on PORT from SOURCE  - Incoming
->  Allow PROTOCOL on PORT from DESTINATION - Outgoing
SSH is TCP Protocol on 22
HTTP is TCP protocol on 80
PING in NCMP Protocol
If Incoming Rule allowed SSH on Port 80 and I did not mention Allow SSH on Port 22 for Outgoing, Even Then SSH will be allowed in Outgoing because its stateful, it remembers.
If Outgoing Rule is allowed, on PORT 80 and We did  not Configure HTTP on Incoming Side
Even then SSH will be allowed on that Machine



Thursday, April 8, 2021

AWS : NAT_Gateway

https://www.youtube.com/watch?v=_JumK1gOYW8

  1. Make an NAT_Gateway . Allocate Elastic IP Address to it.
  2. Place NAT Gateway in Public Subnet, i.e. this subnet should tied to a Route Table which points to Internet Gateway
  3. Place All EC2 Instances in Private Subnet i.e Route Table should point to "NAT_Gateway" for 0.0.0.0/0  Destination

What it essentially does is that All AWS Resources wanting to have - INTERNET Access can point to "NAT_Gateway" device and NAT_Gateway in turn connects to internet.
NAT_Gateway has a static IP Address (Elastic IP Address) and it has special handling that It can allow Connected Devices having Private IP Address to connect to internet because it connects to internet on their behalf, This way we save on Public IP Address Space.

NAT_Gateway is charged Per hour and Per GB basis 

--------------------------------------------------------------------------------------------------------------------------

EC2 instances need to have Public IP Address and Subnet must be connected to Route Table with a Internet Gateway

This Internet Gateway also allows Anyone to reach to EC2 Instances - EC2 is Accessible to World

Problem
What if We don't want EC2 Instances not to be accessible and yet to be able to Access Internet when it wants to ? Private Instances Want to connect to Internet without going through Internet Gateway.

Solution is "NAT Gateway"
NAT Gateway needs Static/Elastic IP Address - A special IP Address which never changes 
"NAT Gateway" - Masks Pvt IP Address and writes its own IP Address and connects to outside world via Internet Gateway
"NAT Gateway" is placed in Public Subnet having a Route Table which routes to Internet Gateway
EC2 Instances having Private IP Addresses in Private Subnet are connected to Route Table which routes to "NAT Gateway"



Azure - Pipeline - Add Approver for Stage

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops&tabs=check-pass