The same EC2 ENI has SG-A and SG-B and uses IPv4. SG-A allows all IPv4 egress; SG-B has no outbound rules. Permit new TCP 443 connections only to a fixed API at 10.30.50.10/32.
Routes, NACLs, and API listeners are verified. Scope is ordinary new IPv4 TCP connections, excluding traffic outside SG control such as AmazonProvidedDNS and immediate termination of existing tracked connections.
How should the associated outbound rules change?
Remove broad egress permissions across attached groups and allow only the fixed API IP and TCP 443.
Detailed explanation
Permissions from multiple SGs are combined. Remove broad authorization and allow the selected IP and port, verifying no other associated group permits additional new egress.
SG-A continues permitting other destinations. Adding a restrictive group does not intersect permissions or override another group.
Destinations use IP/CIDR, prefix lists, or supported SG references, not direct FQDN filtering. Domain-based restrictions require another design.
Ingress controls new inbound connections. Restricting connections initiated by EC2 requires outbound changes.
Check official documentation
Compare the following points with the official documentation.
Inspect every SG and egress rule on an approved test ENI. Prepare the API and another reachable test destination before changes. Compare new connections after changes: API 443 succeeds while other IPs and ports are denied, accounting for routing and NACLs.
Official references
What to confirm
Only new TCP 443 connections to the selected API are permitted. Permissions are combined across SGs; this does not establish immediate termination of tracked connections or blocking of AmazonProvidedDNS.
Key points
- Security group egress
- CIDR
- Connection tracking
Notes
- Environment: Official VPC and EC2 documentation and approved ENI and reachable test listeners
- Reviewed against the linked AWS documentation on 2026-10-15.
Foundation review
Review all associated Allow permissions
Multiple groups combine permissions; a narrower group does not override another. Remove SG-A broad Allow and ensure the full associated set permits no additional new egress beyond the chosen IP and TCP 443. SGs do not have explicit Deny rules.
Check fixed addressing and direction
A fixed IPv4 API can use /32 and TCP 443. SG rules do not directly accept FQDNs; do not apply this fixed-IP design unchanged to changing service IPs. Connections initiated by EC2 require egress restrictions, not merely inbound 443 rules.
Separate new connections from existing state
SG statefulness permits responses to allowed outbound connections without a separate inbound Allow. Routes and NACLs still matter. Do not promise immediate interruption of tracked connections; test new ones. AmazonProvidedDNS is not blocked by SG rules.