Amazon Lightsail provides static IP addresses as a feature that allows users to assign a fixed, persistent public IP to their cloud instances. Unlike the default dynamic IP addresses that change every time an instance is stopped and restarted, a static IP remains constant regardless of what happens to the underlying instance. This makes static IPs particularly valuable for applications that depend on a consistent address, such as websites with DNS records pointing to a specific IP or services that whitelist addresses for security purposes.
The allocation of a static IP in Lightsail is straightforward and takes only a few clicks through the console. However, the simplicity of that process is precisely what creates a management challenge over time. Teams provision static IPs quickly for projects, attach them to instances, and then move on. When those instances are deleted or replaced, the static IPs sometimes remain behind — allocated, billable, and completely idle. Recognizing this pattern is the first step toward building a system that catches it automatically.
Why Unattached Static IPs Become a Silent Cost Problem
Amazon Lightsail does not charge an additional fee for a static IPv4 address attached to a Lightsail instance. AWS states that an address left unattached for more than one hour incurs $0.005 per hour. This is a time-based charge, not an unconditional monthly subscription. At that stated rate, an IP left unattached for an entire 30-day month after the initial grace period would generate roughly $3.60, before any future pricing changes. The cost is modest for one address but can add up across multiple accounts and regions; verify the current official Lightsail pricing before relying on a forecast.
The deeper problem is visibility. Unlike compute costs, which appear clearly in billing dashboards as instance-hours, idle static IPs tend to hide in the line items of a cloud bill without obvious attribution. Engineers who decommission instances often do not return to release the associated static IP, not out of negligence but because the process of deletion and the process of IP release are separate actions in the Lightsail workflow. Without an automated system flagging these idle resources, manual audits are the only alternative — and manual audits depend on someone remembering to perform them.
The Architecture Behind an Automated Notification System
Building an automated notification system for unused Lightsail static IPs requires connecting several AWS services into a coherent workflow. At the foundation, you need a mechanism that periodically queries the Lightsail API to retrieve all allocated static IPs and checks whether each one is currently attached to an instance. That query layer feeds into a logic component that filters for unattached addresses and formats the findings into a notification. The notification then travels through a delivery channel to the appropriate person or team.
AWS Lambda functions serve as the natural execution layer for this kind of periodic query logic. Lambda allows you to run code without managing servers, and it integrates directly with the Lightsail API through the AWS SDK. Amazon EventBridge provides the scheduling layer, triggering the Lambda function at whatever interval makes sense for your environment — daily, twice weekly, or weekly depending on how aggressively you want to monitor for idle resources. Amazon SNS handles the notification delivery, sending alerts via email or SMS to whoever manages your Lightsail infrastructure. Together, these three services form a lightweight, serverless pipeline that requires minimal maintenance once deployed.
Read-only Lightsail inventory and a scheduled check
The Lambda function can call the Lightsail `GetStaticIps` API in a chosen AWS region and evaluate each returned static IP record. The response exposes `name`, `ipAddress`, `location.regionName`, `attachedTo`, `isAttached` and `createdAt`; it can be paginated using a page token. The key finding is `isAttached == false`. A single first-page response is not a reliable full inventory when many addresses exist. The API records creation time, not an authoritative “last detached” timestamp, so the code must not infer a billing start date or idle duration from `createdAt`.
A minimal Python implementation can use boto3.client("lightsail", region_name=region).get_paginator("get_static_ips") to enumerate all pages. For each returned record, check not record.get("isAttached", False) and collect its name, IP address and region. Test API pagination and failed regional requests with controlled fixtures. A production implementation should also handle SDK errors, limit request concurrency, identify the AWS account, suppress duplicate alerts and never invoke release_static_ip from the read-only monitoring path.
For repeat detection, an external state store may remember the first observation time of an unattached address and the last successful poll. This makes an aging alert possible without inventing a detach timestamp from the API. State retention, consistency and access-control requirements must be considered before adding the store; for a small account, a stateless daily report may be more maintainable.
Writing this function requires configuring appropriate IAM permissions so that the Lambda execution role can both call the Lightsail API and publish messages to an SNS topic. The principle of least privilege applies here — the role should have exactly the permissions needed for these two operations and nothing more. Once the function is written and the role is configured, deploying it through the Lambda console or through infrastructure-as-code tools like AWS CloudFormation or the Serverless Application Model takes only a few minutes. Testing with a manual invocation before connecting the scheduler confirms that the query logic and notification delivery work as expected.
A scheduled check can be implemented using Amazon EventBridge Scheduler, which supports recurring schedules and a configured invocation target. Historic EventBridge scheduled rules also exist, but new implementations should compare them with the dedicated Scheduler capability and associated execution-role requirements. A daily interval usually provides adequate visibility for idle addresses, whereas a very short interval increases invocation volume without changing the underlying charging rule. Schedule in an explicit time zone or use UTC and document when the first run should occur.
Configure the schedule target and permissions deliberately: the Scheduler service may assume a scoped execution role to invoke Lambda, while Lambda runs under a separate execution role with read-only Lightsail access and publish access to the intended SNS topic. These are different trust relationships. A secure setup checks the invocation role, Lambda resource and identity policies, and target topic policy as applicable. Log failed invocations and test both scheduling and delivery before relying on the system to warn about idle resources.
Delivering useful notifications
Amazon Simple Notification Service provides the messaging backbone that gets your findings from the Lambda function to the people who need to act on them. SNS operates on a publish-subscribe model: your Lambda function publishes a message to an SNS topic, and that topic delivers the message to all of its subscribers. Subscribers can be email addresses, phone numbers for SMS delivery, or even other AWS services like SQS queues if you want to integrate the notifications into a broader workflow management system.
Setting up an SNS topic for this use case is a quick process. You create the topic, add the relevant subscribers, and confirm their subscriptions through the verification emails SNS sends automatically. The Lambda function then publishes to this topic whenever it detects unattached static IPs. Crafting the message body thoughtfully makes a significant difference in usability. A notification that simply says “unused IPs detected” is less actionable than one that lists each idle IP by name, includes its region, and provides the direct URL to the Lightsail console where the IP can be reviewed and released. The extra effort in message formatting pays off every time someone receives and acts on the alert.
Least-privilege permissions across regions
Security is a first-order concern when building any automated system that interacts with cloud infrastructure. The IAM role attached to your Lambda function defines the boundaries of what that function can do within your AWS account, and those boundaries should be drawn tightly. For this notification system, the Lambda execution role needs three specific permissions: the ability to read static IP data from Lightsail, the ability to publish messages to the designated SNS topic, and the standard permissions Lambda requires to write its own execution logs to CloudWatch Logs.
Granting overly broad permissions — such as full Lightsail access or unrestricted SNS publish rights across all topics — introduces unnecessary risk without providing any operational benefit. If the Lambda function were ever compromised or its logic contained an error, broad permissions would amplify the potential impact. Scoping the Lightsail permission to the GetStaticIps action and the SNS permission to the specific topic ARN limits blast radius effectively. Reviewing these permissions periodically as part of a broader IAM audit ensures they remain appropriately scoped as your infrastructure evolves.
Amazon Lightsail operates on a per-region basis, which means static IPs allocated in one region are entirely separate from those in another. A notification system that only queries a single region will miss idle IPs in any other region where your team has deployed resources. For organizations that operate Lightsail instances across multiple regions — perhaps running workloads closer to end users in different geographies — this regional isolation requires deliberate handling in the automation design.
The most straightforward approach to multi-region coverage is configuring the Lambda function to iterate through a predefined list of regions, querying the Lightsail API in each one and aggregating the results before composing the notification. This requires the Lightsail API client to be initialized separately for each region within the function’s execution loop. An alternative approach is deploying separate Lambda functions in each region, each responsible only for its local Lightsail environment, with all of them publishing to the same SNS topic. Both approaches work reliably; the choice depends on whether you prefer centralized logic or regional independence.
A raw list of unattached IP addresses delivered as a notification is technically useful but practically cumbersome. The person receiving the notification needs enough context to act on it efficiently — ideally without having to cross-reference multiple consoles or documentation pages to understand what they are looking at. Investing time in the formatting logic within your Lambda function significantly improves the usability of every notification the system sends.
Each notification should include the static IP name, IPv4 address, AWS region, attachment state, account or environment identifier and a clear owner action. The current Lightsail GetStaticIps response includes a creation timestamp, but does not by itself report when the IP was last detached; do not label `createdAt` as an idle-since date. To measure a proven idle interval, store the first time an unattached state was observed in an external history store and reset that observation when attachment resumes. Distinguish observed duration from billing data, and require human review before releasing an address that may be reserved for failover.
Once the foundational architecture for static IP monitoring is in place, the same pattern applies naturally to other categories of idle Lightsail resources. Lightsail snapshots are another common source of quiet, accumulating costs — teams create manual or automated snapshots for backup purposes and then forget to prune older ones as new ones are taken. Lightsail disks that were detached from instances and never deleted represent another category of resource that incurs ongoing charges without providing active value.
Extending the Lambda function to include checks for these additional resource types requires only additional API calls and filtering logic within the same execution framework. The EventBridge schedule and SNS notification pipeline remain unchanged. The notification message simply expands to include findings across all monitored resource categories. This modular expansion approach allows you to build a comprehensive idle resource monitoring system incrementally rather than attempting to build everything at once. Start with static IPs, validate that the system works reliably, then add snapshot and disk monitoring in subsequent iterations.
Ownership records beyond API attributes
Resource ownership makes notifications actionable, but the Lightsail static IP API response does not expose an ordinary `tags` collection in the GetStaticIps resource fields. Do not assume static IPs can be reliably assigned teams by reading arbitrary resource tags from that response. Instead, maintain an account-and-region ownership inventory, record the IP name and its responsible team, or link it to controlled deployment metadata. A resource that can be detached without a corresponding inventory update needs a reconciliation process.
For example, an address with no current attachment and an owner registry showing that its project was decommissioned is a reasonable cleanup candidate. The notification should still ask the owner to verify whether a cutover, DNS record, allowlist or disaster-recovery plan depends on the address before deletion. A high-priority alert is not permission for the script to release an address automatically. Document the last confirmed owner and the evidence used to classify it as unused.
Testing detection and delivery
Before relying on any automated monitoring system for production infrastructure decisions, thorough testing is essential. For this notification pipeline, testing should cover several distinct scenarios: the case where no idle static IPs exist and no notification should be sent, the case where one or more idle IPs exist and a properly formatted notification should arrive, and the case where the Lightsail API returns an error and the function handles it gracefully rather than failing silently. Each scenario requires a different assertion about the expected behavior.
Lambda’s testing tools within the AWS console allow you to invoke the function manually with simulated events, making it straightforward to trigger execution on demand. To test the idle IP detection logic specifically, you can temporarily allocate a static IP in Lightsail without attaching it to an instance, run the function, and confirm that the notification arrives with the correct details. Cleaning up the test IP afterward prevents it from becoming exactly the kind of idle resource the system was built to catch. Documenting these test cases and running them again after any changes to the function ensures the system behaves reliably as it evolves.
An automated monitoring system is only as valuable as its own reliability, which means the notification pipeline itself needs to be monitored. If the Lambda function fails during execution — due to a permissions error, an API timeout, or a code defect — and that failure goes unnoticed, you lose the monitoring coverage you built the system to provide. AWS CloudWatch offers the observability tools needed to ensure the function operates correctly over time.
CloudWatch automatically captures Lambda execution logs, which include any errors or exceptions thrown during the function’s run. Setting up a CloudWatch alarm on the Lambda error metric ensures that failed executions trigger an alert just as readily as idle static IPs do. You can route these operational alerts through the same SNS topic as your Lightsail notifications or through a separate topic dedicated to infrastructure health monitoring. Either way, the goal is the same: ensuring that a silent failure in the automation does not leave you with a false sense of coverage while idle resources quietly accumulate costs.
Cost and ongoing team operations
One of the appealing characteristics of this serverless notification architecture is its extremely low operational cost. AWS Lambda charges based on the number of invocations and the duration of each execution. A function that runs once daily and completes in under a second will fall well within the Lambda free tier for most accounts, meaning the execution cost rounds to zero for practical purposes. Amazon EventBridge rules that trigger Lambda functions also fall within free tier limits at this invocation frequency.
Amazon SNS and Lambda can be inexpensive for infrequent notifications, but pricing depends on request count, delivery mechanism, region and the service’s current published schedule. Email delivery costs and free tiers should be checked rather than stated as universally free. A solution that polls many regions or sends duplicate alerts can produce unwanted notification traffic even if compute use is small. Compare actual monthly operating cost with the idle address savings and the human time needed to verify releases.
Individual developers managing personal Lightsail projects have straightforward monitoring needs, but teams operating shared environments introduce coordination complexity that the notification system should accommodate. In a team context, a single notification sent to a shared email alias may not create sufficient accountability — if everyone receives the alert, it can become easy for everyone to assume someone else will handle it. Structuring notifications to route to specific team members based on resource ownership tags solves this problem directly.
Routing notifications to individual owners requires an external owner mapping or application inventory rather than assuming that every returned static IP has an owner tag. The Lambda function can include a project or team only where the ownership registry is reliable. Otherwise, send a clearly labeled unassigned alert to a central cloud operations queue. Avoid embedding personal email addresses or sensitive account metadata in broadly readable Lambda source code; put notification configuration in a controlled parameter or configuration store.
Building an automated notification system for unused Lightsail static IPs is a concrete expression of a broader principle in cloud infrastructure management: the systems you build should work harder than the humans operating them. Manual audits require someone to remember, schedule time, and execute a repetitive process without error. Automated systems do none of those things — they run on schedule, apply consistent logic, and deliver findings to the right people without relying on human memory or initiative. That asymmetry compounds in value over the lifetime of a cloud environment.
The architecture described throughout this article — Lambda for execution, EventBridge for scheduling, SNS for notification delivery, and IAM for secure access — is not specific to static IP monitoring. It is a reusable pattern that applies to virtually any periodic check you want to perform against your AWS infrastructure. Once you have built and validated this system for static IPs, you have also built the template for monitoring idle disks, aging snapshots, underutilized instances, and any other resource category where drift between allocation and actual use creates costs or risks.
Sustainable cloud cost management is not achieved through periodic cleanup sprints or quarterly audits performed under budget pressure. It is achieved through continuous, lightweight visibility that makes idle resources visible before they accumulate into significant waste. The investment required to build this notification pipeline is measured in hours. The return, in terms of cost savings, reduced audit burden, and improved infrastructure hygiene, compounds across every week the system runs. Teams that embed this kind of automation early in their cloud operations develop a discipline that scales naturally as their infrastructure grows, rather than discovering the cost of neglect after the bill has already arrived. Start with static IPs, build the habit of automated accountability, and let the system do the work of keeping your cloud environment clean and intentional.