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-08-01 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 based on Table 1. 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.
      Table 1 Scenarios and policies for clearing connection tracking entries

      Scenario

      Clearing Policy

      Adding instances to security group A

      • Clear inbound connection tracking entries of the instances newly added to security group A.
      • If an inbound rule of another security group (for example, security group B) denies access from security group A, clear inbound connection tracking entries of all instances in security group B.

      Removing instances from security group A

      • Clear inbound connection tracking entries of all instances in security group A.
      • If an inbound rule of another security group (for example, security group B) allows access from security group A, clear inbound connection tracking entries of all instances in security group B.

      Adding rules to security group A

      If a Deny rule is added in the inbound or outbound direction, clear inbound connection tracking entries of all instances in security group A.

      Deleting rules from security group A

      If an Allow rule is deleted in the inbound direction, clear inbound connection tracking entries of all instances in security group A.

      Modifying rules in security group A

      If the priority, action, protocol, port, or source address of a rule is modified in the inbound direction, clear inbound connection tracking entries of all instances in security group A.

      Enabling rules in security group A

      If a Deny rule is enabled in the inbound or outbound direction, clear inbound connection tracking entries of all instances in security group A.

      Disabling rules in security group A

      If an Allow rule is disabled in the inbound direction, clear inbound connection tracking entries of all instances in security group A.

      Changing IP address entries in an IP address group

      If an IP address group is associated with an inbound rule in security group A, deleting or adding an IP address entry from or to the IP address group will clear inbound connection tracking entries of all instances in security group A.

    • 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.