For example if my EC2-1 machine have the ip of 192.162.10.2 and the EC2-2 machine have the ip of 192.168.10.150 let say,
How can I achive this, Thank you
I’m try to connect to EC2 instance in the same network, I’m new in the cloud services.
For example if my EC2-1 machine have the ip of 192.162.10.2 and the EC2-2 machine have the ip of 192.168.10.150 let say,
How can I achive this, Thank you
I’m try to connect to EC2 instance in the same network, I’m new in the cloud services.
2
Answers
Amazon EC2 instances in the same VPC can communicate with each other.
Just make sure that the Security Groups associated with the instances permit the communication.
For example, let’s say one EC2 instance is running a web application and the other is running a database. You might then create two security groups:
Web-SG
) that permits inbound traffic on port 80 and 443, plus all Outbound trafficDB-SG
) that permits inbound traffic fromWeb-SG
on the database port, plus all Outbound trafficThat is,
DB-SG
can specifically refer toWeb-SG
in its rules. This way, any EC2 instance that is associated withWeb-SG
will be permitted to accessDB-SG
. This is better than hard-coding IP addresses in security group rules.Make sure both EC2 instances are launched within the same VPC. By default, instances launched in the same VPC can communicate with each other.
Make sure both EC2 instances are in the same subnet within the VPC.
Ensure that the security group allows traffic between instances within the same security group.
Make sure both instances are running and accessible (eg using SSH)
And then try to ping one EC2 from another by their private IP-address.