Delete unused Elastic IP
What It Does
Releases unused Elastic IP (EIP) addresses that are not currently associated with any resource. Elastic IPs incur charges when idle. This runbook detects unassociated EIPs and automatically releases them to reduce unnecessary cost.
Risk and Scope
Risk Level
Low
AWS Service Targeted
Amazon VPC
Permissions Required
Delete Permissions
ec2:ReleaseAddress
Read Permissions
ec2:DescribeAddresses
These permissions are granted only to the runbook, not to the OneLens platform itself.
Optimization Policies Addressed
This runbook remediates violation tickets of the following policy:
vpc_102
Detect Elastic IPs attached to stopped EC2 Instances for over certain days
vpc_101
There should be no unused Elastic IPs
Risk Mitigation
Risk Mitigation Strategy
The change is assessed as low risk with limited scope and impact.
No downtime is expected during or after implementation.
No additional safety measures are required due to the non-disruptive nature of the change.
A rollback plan is not defined, as standard procedures are sufficient to manage the change.
How to Install
Runbook Workflow
Step 1: Start
Trigger: Begins the workflow. A description of the target EIP and its allocation ID is provided here.
Step 2: checkForUnusedIP
checkForUnusedIP
Action: Executes a script to check if the Elastic IP is not associated with any EC2 instance or network interface.
Step 3: If/Else
If/Else
Condition: Evaluates whether the EIP is indeed unused.
If true:
ReleaseElasticIp
Uses
ReleaseAddress
on EC2 to release the Elastic IP and stop idle cost accumulation.
Else:
Exits without making any changes.
See How it Works
Triggering the Runbook
To run this workflow:
1. Locate the Ticket
Identify the ticket associated with the above mentioned policy violation.
2. Execute the Runbook
Last updated