Help Center/ Virtual Private Cloud/ FAQs/ Security/ Does a New Security Group Rule or Network ACL Rule Take Effect Immediately for Existing Connections?
Updated on 2025-06-10 GMT+08:00

Does a New Security Group Rule or Network ACL Rule Take Effect Immediately for Existing Connections?

  • Security groups use connection tracking to track traffic to and from instances. Changes to inbound rules take effect immediately for existing connections. Changes to outbound security group rules do not affect existing persistent connections and take effect only for new connections.

    If you add, delete, or update rules in a security group, or add or remove instances in a security group, the details are as follows:

    • For connections established by inbound traffic, the system automatically clears the connection tracking entries corresponding to the existing persistent connections. That is, the connection tracking entries are expired in advance. Then, the system re-establishes connections to match the new inbound rules of the security group.
      • If the security group rules allow the traffic of the connections, the connections can be established and network communication is not affected.
      • If the security group rules deny the traffic of the connections, the connections cannot be established again and the network communication will be interrupted.
    • The existing outbound persistent connections will not be disconnected, and the original rule will still be applied. All the new connections will match the new rules.
  • Network ACLs use connection tracking to track traffic to and from instances. Changes to inbound and outbound rules do not take effect immediately for the existing traffic.

    If you add, modify, or delete a network ACL rule, or associate or disassociate a subnet with or from a network ACL, all the inbound and outbound persistent connections will not be disconnected. New rules will only be applied for the new connections.

After a persistent connection is disconnected, new connections will not be established immediately until the timeout period of connection tracking expires. For example, after an ICMP persistent connection is disconnected, a new connection will be established and a new rule will be applied when the timeout period (30s) expires.

  • The timeout period of connection tracking varies by protocol. The timeout period of a TCP connection in the established state is 600s, and that of an ICMP connection is 30s. For other protocols, if packets are received in both inbound and outbound directions, the connection tracking timeout period is 180s. If packets are received only in one direction, the connection tracking timeout period is 30s.
  • The timeout period of TCP connections varies by connection status. The timeout period of a TCP connection in the established state is 600s, and that of a TCP connection in the FIN-WAIT state is 30s.