I want to connect two ec2 instances with each other so that they can communicate with each other. I found the problem on the way we can connect 2 Ec2 instances with each other.
I have Provided the scenario also.EC2-Scenario
I want to connect two ec2 instances with each other so that they can communicate with each other. I found the problem on the way we can connect 2 Ec2 instances with each other.
I have Provided the scenario also.EC2-Scenario
To keep it very simple, For any two programs to communicate with each other over a network, you need two things
Consider you have two EC2 instances. Lets name them
On each of these instances, you must be having some programs between which you want the communication to take place. Also, these programs must be running on a PORT of the instance. For example, tomcat instance runs on port 8080 by default. Lets name our programs:-
Let us first talk about Program1 running on port 1000 of Instance1.
-Type: Custom TCP Rule
-Protocol: TCP
-Port Range: 1000 [Or any other port on which your program runs]
-Source: External IP from where Program1 can be accessed. It can be "Everywhere", "My IP" or a "Custom IP"
Repeat these steps on Instance2 and you will be good to go.
Well , you can launch the instances in a amazon VPC , then infront of your App server you can place a Load balancer for traffic. The VPC must have a internet gateway attached to it as well. To access the whole VPC , you can create a jumpbox/bastion host.
Based on your "Ec@ Scenario" image, you can add your "application server" & "backend server" under respective load balancer & can communicate with each other using LB name/end-point url. This would ensure, even if the underling EC2 instance shutdown/re-instanced, the communication won't break.