How to connect an EC2 linux instance to another Linux instance

0 votes
How to access another Linux server from a Linux server by configuring the security group (firewall)?
Jul 16, 2019 in AWS by code_ninja
• 6,290 points

1 answer to this question.

0 votes

AWS EC2 instances are more like a server which provide the hosting platform 

As your concern is how to connect two EC2 instances then try this way:

1) Go to EC2 console and note down IP and security ID of both the linux instances 

2) Select any one instance and open network and security option 

3) Select your instance's security group and click on edit

4) In the next popup window click on “Add Rule” button 

5) Now Select All ICMP-ipv4 under Type drop-down, set source tab to custom and in the next box enter the security group id of the other instance (which is “sg-d0e7d4b9” )click on save button.

6) Now open CLI connect to instance and try to ping to other instance

  • [root@ip-172-31-25-150 ~]# ping

7)To make the communication open from other instance as well, follow the steps 1 to 3 for other security group “sg-d0e7d4b9” and in the step 4 enter below details and click save button.

8) After above configuration we are now able to ping the first instance via second instance

  • [root@ip-172-31-23-137 ~]# ping
  • PING ( 56(84) bytes of data.

This way two Ec2 instances connect to each other. In case of other ports or service please select particular service such as ssh, http or even NFS make sure you open the source with custom mentioning the security group id of the other server.


answered Jul 16, 2019 by ArchanaNagur
• 2,360 points

Related Questions In AWS

0 votes
1 answer

How to launch an EC2 instance with IAM-Role?

The credentials you are using from your ...READ MORE

answered Sep 3, 2018 in AWS by Archana
• 4,170 points
0 votes
1 answer

how to connect my ec2 instance to a registered domain?

Hard to troubleshoot on here- but I ...READ MORE

answered Sep 24, 2018 in AWS by Priyaj
• 58,100 points
0 votes
2 answers

How to recover lost private key of an EC2 instance?

I'm afraid it's not possible When you launch ...READ MORE

answered Sep 25, 2018 in AWS by Archana
• 4,170 points
0 votes
1 answer

How to safely upgrade an Amazon EC2 instance from t1.micro to large?

Using AWS Management Console: Right-Click on the instance Instance ...READ MORE

answered Oct 8, 2018 in AWS by Priyaj
• 58,100 points
0 votes
1 answer
+2 votes
1 answer

How to connect to EC2 file directory using SFTP and Filezilla?

To connect to EC2 instance using Filezilla, ...READ MORE

answered Jul 27, 2018 in Cloud Computing by Gopalan
• 1,360 points