This is the case:
- Instance
X
is able to connect to instanceY
on TCP port27017
(allowed by EC2 security group) X
has mongo shellY
has MongoDB running, accepting connection fromX
on port27017
- From
X
, use mongo shell to connect to DB instance onY
- From this mongo shell session on
X
, query fromY
and insert toY
. All is successful. - Change security group of
Y
: remove the rule of port27017
mentioned in #1 X
can still query from/insert to DB hosted onY
. This is not expected.- Exit mongo shell session on
X
- Try step 4 again and failed. This is normal and expected.
Expectation is that EC2 network firewall will terminate connections that violate the rules (the security group policies).
Could you please explain how #7 above happens? And how can that be avoided (so X
cannot do anything to Y
at that time)?
Thank you.