This rule ensures EC2 instances do not have a public IP address for enhanced security.
Rule | EC2 instances should not have a public IP address |
Framework | NIST 800-53 Revision 5 |
Severity | ✔ High |
Rule Description:
According to NIST 800-53 Revision 5, it is recommended that EC2 instances should not have a public IP address. This rule aims to improve the security posture of the infrastructure by minimizing potential attack vectors and reducing the exposure of instances to the public internet.
Troubleshooting Steps:
Identify EC2 instances with public IP addresses:
Review instance requirements:
Verify security group settings:
Check network ACLs:
Validate routing configurations:
Remediation Steps:
Remove public IP:
aws ec2 modify-instance-attribute --instance-id <instance-id> --no-associate-public-ip-address
Replace
<instance-id>
with the ID of the instance you want to modify.Adjust security group settings:
aws ec2 authorize-security-group-ingress --group-id <security-group-id> --protocol <protocol> --port <port> --source-security-group <source-security-group-id>
Replace
<security-group-id>
, <protocol>
, <port>
, and <source-security-group-id>
with the appropriate values for your security group configuration.Review network ACLs:
aws ec2 create-network-acl-entry --network-acl-id <network-acl-id> --protocol <protocol> --rule-action <rule-action> --rule-number <rule-number> --cidr-block <cidr-block> --port-range From <port> To <port>
Replace
<network-acl-id>
, <protocol>
, <rule-action>
, <rule-number>
, <cidr-block>
, <port>
, and <port>
with the appropriate values for your network ACL configuration.Update routing configurations:
aws ec2 create-route --route-table-id <route-table-id> --destination-cidr-block <destination-cidr-block> --gateway-id <gateway-id>
Replace
<route-table-id>
, <destination-cidr-block>
, and <gateway-id>
with the appropriate values for your routing configuration.Note:
<gateway-id>
should be the ID of the internet gateway associated with your VPC.By following the above steps, you can ensure compliance with NIST 800-53 Revision 5 by removing public IP addresses from EC2 instances and securing your infrastructure.