Skip to content

Lambda function to publish the IP Address availability in all VPC-based subnets as CloudWatch Metrics.

License

Notifications You must be signed in to change notification settings

next-insurance/VpcSubnetIpMonitor

 
 

Repository files navigation

VpcSubnetIpMonitor

Lambda function to publish the IP Address availability in all VPC-based subnets as CloudWatch Metrics.

Built using AWS Serverless Application Model.

Preface

In AWS, private IP addresses are used with Elastic Network Interfaces (ENIs) to provide local routing for EC2 Instances, ECS/Fargate containers, Lambda Functions, RDS/Redshift databases, and more. It's important to right-size your subnets, but this is difficult to predict early in your application's lifecycle, and difficult to change later. Keeping track of IP address availability requires checking each subnet's AvailableIpAddressCount via a DescribeSubnets API call.

VpcSubnetIpMonitor is a Lambda function that can be deployed in an AWS account that will call the DescribeSubnets API and output custom CloudWatch Metrics, with the SubnetId as a dimension.

Metrics

  • AvailableIpAddressCount - Quantity of IP Addresses Available
  • TotalIpAddressCount - Quantity of Total IP Addresses in Subnet (based on CIDR size)
  • AvailableIpAddressPercent - Percentage of Available to Total IP Addresses

Deployment

Deploy using CloudFormation: Deploy to AWS

To deploy to AWS manually, see Create Your Own Serverless Application : Packaging and Deployment using this repository.

Once the function is running and reporting metrics, you can create CloudWatch Alarms for each subnet that alert if a subnet starts to reach its maximum capacity.

About

Lambda function to publish the IP Address availability in all VPC-based subnets as CloudWatch Metrics.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HCL 54.6%
  • JavaScript 45.4%