sumanth shetty
sumanth shetty

Reputation: 2181

2 ec2 instance interacting with each other

I am new to aws and ec2 interaction with traffic flow.

I have one ec2 instance which I am using as a web server and other as an application server. how can my two ec2 interact with each other maintaining all the security required?

Both the ec2 machines are on the ubuntu image.

I tried adding All ICMP - IPv4 with source 0.0.0.0/0. I feel it's not the correct way I want only my other instance to access it.

I also tried adding source as other instance security group but didn't work. I was not able to ping from one machine to other

Upvotes: 0

Views: 1117

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269101

The recommended security configuration would be:

  • Create a Security Group for the web server (Web-SG) that permits Inbound traffic for HTTP and HTTPS (ports 80, 443). Leave the Outbound configuration as the default "Allow All".
  • Create a Security Group for the app server (App-SG) that permits Inbound traffic from Web-SG on the desired ports. Leave the Outbound configuration as the default "Allow All".

That is, App-SG should specifically refer to Web-SG in the Inbound rules. This will permit traffic from Web-SG to enter App-SG.

You might want to add additional access so that you can manage the instances (eg SSH), or you can use AWS Systems Manager Session Manager to connect.

Do not use Ping to test access since that requires additional settings and only proves that Ping works. Instead, test the actual access on the desired ports (eg port 80).

Upvotes: 1

Related Questions