This rule ensures that VPC Elastic IPs are properly linked to EC2 instances or Elastic Network Interfaces.
Rule | VPC EIPs should be associated with an EC2 instance or ENI |
Framework | CISA-cyber-essentials |
Severity | ✔ High |
Rule Details:
According to CISA Cyber Essentials guidelines, elastic IP addresses (EIPs) in a Virtual Private Cloud (VPC) should always be associated with either an EC2 instance or an Elastic Network Interface (ENI).
EIPs are public IPv4 addresses that can be dynamically remapped to different instances if necessary. However, leaving EIPs unassociated or not properly associated with EC2 instances or ENIs may lead to security risks or misconfiguration issues.
Troubleshooting Steps (if applicable):
If you encounter any issues or alerts related to unassociated EIPs in your VPC, follow these troubleshooting steps:
Identify Unassociated EIPs: Use the AWS Management Console, AWS CLI, or SDKs to identify any unassociated EIPs within your VPC.
Verify the Purpose: Check the purpose or requirement for each unassociated EIP. Determine if it should be associated with a specific EC2 instance or ENI.
Determine Root Cause: Identify the reason behind the unassociated status. It could be due to a manual disassociation, instance termination, or any other configuration error.
Verify Availability: Ensure that the EC2 instance or ENI associated with the EIP is in the "available" state and not stopped, terminated, or experiencing any other issues.
Associate EIP: If necessary, associate the unassociated EIP with the correct EC2 instance or ENI using AWS Management Console, AWS CLI, or SDKs.
Necessary Codes (if applicable):
If you need to use code to troubleshoot or perform the necessary actions, you can consider the following AWS CLI commands:
aws ec2 describe-addresses --filters Name=association-id,Values=null
aws ec2 associate-address --instance-id <instance_id> --public-ip <eip_address>
aws ec2 associate-address --network-interface-id <eni_id> --public-ip <eip_address>
Step-by-Step Guide for Remediation:
To remediate the unassociated EIPs issue in your VPC, follow these steps: