| Crates.io | aws-vpc-prefix-list-monitor |
| lib.rs | aws-vpc-prefix-list-monitor |
| version | 0.1.1 |
| created_at | 2025-10-08 02:20:52.090917+00 |
| updated_at | 2025-10-08 02:25:22.617894+00 |
| description | A tool to monitor your external public IP address and automatically updates an AWS VPC managed prefix list entry. Perfect for maintaining access to AWS resources from dynamic IP addresses. |
| homepage | https://github.com/kariudo/aws-vpc-prefix-list-updater |
| repository | https://github.com/kariudo/aws-vpc-prefix-list-updater |
| max_upload_size | |
| id | 1873283 |
| size | 104,479 |
AWS VPC Prefix List Updater is a π₯ blazingly-fast, π§ memory-safe, π batteries-included, πΊergonomic, π¦ 100% Rust-powered daemon that monitors your external public IP address and automatically updates an AWS VPC managed prefix list entry. Perfect for maintaining access to AWS resources from dynamic IP addresses.
Consider keeping me caffinated:
I got really tired of having to go into the AWS console to whitelist my IP in a prefix list every time my power at home flickered causing my fiber gateway to give me a new IP address. So my solution... code! So I wrote this tool for myself but you should use it too!
This tool is ideal when you need to:
git clone <repository>
cd aws-vpc-prefix-list-monitor
cp .env.example .env
# Edit .env with your settings
docker-compose up -d
docker-compose logs -f
# Build
docker build -t aws-prefix-monitor .
# Run
docker run -d \
--name prefix-monitor \
--restart unless-stopped \
-e PREFIX_LIST_ID=pl-12345678 \
-e AWS_REGION=us-east-1 \
-e AWS_ACCESS_KEY_ID=your_key \
-e AWS_SECRET_ACCESS_KEY=your_secret \
-e CHECK_INTERVAL=300 \
aws-prefix-monitor
cargo build --release
./target/release/aws-vpc-prefix-list-monitor \
--prefix-list-id pl-12345678 \
--region us-east-1
| Variable | Required | Default | Description |
|---|---|---|---|
PREFIX_LIST_ID |
Yes | - | AWS managed prefix list ID (e.g., pl-12345678) |
AWS_REGION |
No | us-east-1 | AWS region |
AWS_ACCESS_KEY_ID |
No* | - | AWS access key |
AWS_SECRET_ACCESS_KEY |
No* | - | AWS secret key |
ENTRY_DESCRIPTION |
No | "Auto-updated host IP" | Description for managed entries |
CHECK_INTERVAL |
No | 300 | Seconds between IP checks |
CIDR_SUFFIX |
No | 32 | CIDR suffix (32 = single host) |
IP_SERVICE_URL |
No | https://api.ipify.org | IP detection service |
RUST_LOG |
No | info | Log level (trace/debug/info/warn/error) |
*Not required if using IAM roles/instance profiles
Options:
-r, --region <REGION> AWS region [env: AWS_REGION]
-p, --prefix-list-id <ID> Prefix list ID [env: PREFIX_LIST_ID]
-d, --description <DESC> Entry description [env: ENTRY_DESCRIPTION]
-i, --interval <SECONDS> Check interval [env: CHECK_INTERVAL]
--ip-service <URL> IP service URL [env: IP_SERVICE_URL]
--cidr-suffix <BITS> CIDR suffix [env: CIDR_SUFFIX]
--once Run once and exit (for testing)
-h, --help Print help
-V, --version Print version
The tool only manages entries with the specific description you configure, leaving other entries untouched.
The AWS credentials must have these permissions:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:DescribeManagedPrefixLists",
"ec2:GetManagedPrefixListEntries",
"ec2:ModifyManagedPrefixList"
],
"Resource": "*"
}
]
}
For production, scope the Resource to specific prefix list ARNs:
"Resource": "arn:aws:ec2:us-east-1:123456789012:prefix-list/pl-12345678"
Test without starting the daemon:
# Test one update cycle
docker run --rm \
-e PREFIX_LIST_ID=pl-12345678 \
-e AWS_REGION=us-east-1 \
-e AWS_ACCESS_KEY_ID=your_key \
-e AWS_SECRET_ACCESS_KEY=your_secret \
-e RUST_LOG=debug \
aws-prefix-monitor --once
Or with source build:
cargo run -- --prefix-list-id pl-12345678 --once
docker-compose logs -f prefix-list-monitor
The container includes a health check that runs the tool in --once mode to verify AWS connectivity.
INFO Starting prefix list monitor
INFO Prefix List ID: pl-12345678
INFO Description: Auto-updated host IP
INFO Check interval: 300s
DEBUG Detected external IP: 203.0.113.42
INFO IP change detected: none -> 203.0.113.42
INFO Adding new CIDR 203.0.113.42/32 to prefix list
INFO Successfully updated prefix list to version 2
INFO β Prefix list updated successfully
# task-definition.json
{
"family": "prefix-list-monitor",
"taskRoleArn": "arn:aws:iam::123456789012:role/prefix-list-updater-role",
"containerDefinitions":
[
{
"name": "monitor",
"image": "your-registry/aws-prefix-monitor:latest",
"environment":
[
{ "name": "PREFIX_LIST_ID", "value": "pl-12345678" },
{ "name": "AWS_REGION", "value": "us-east-1" },
],
},
],
}
docker run -d \
--name prefix-monitor \
--restart unless-stopped \
-e PREFIX_LIST_ID=pl-12345678 \
-e AWS_REGION=us-east-1 \
aws-prefix-monitor
apiVersion: apps/v1
kind: Deployment
metadata:
name: prefix-list-monitor
spec:
replicas: 1
template:
spec:
serviceAccountName: prefix-list-updater # With IRSA
containers:
- name: monitor
image: aws-prefix-monitor:latest
env:
- name: PREFIX_LIST_ID
value: "pl-12345678"
- name: AWS_REGION
value: "us-east-1"
docker logs prefix-list-monitorRUST_LOG=debugIf ipify.org is unavailable, configure alternatives:
# Using ifconfig.me
IP_SERVICE_URL=https://ifconfig.me
# Using icanhazip.com
IP_SERVICE_URL=https://icanhazip.com
# Using AWS checkip
IP_SERVICE_URL=https://checkip.amazonaws.com
Run tests:
cargo test
Run locally with debug logging:
RUST_LOG=debug cargo run -- \
--prefix-list-id pl-12345678 \
--once
Build optimized binary:
cargo build --release
MIT License - see LICENSE for details.
Made with β€οΈ by kariudo | β Support the developer
We welcome contributions! Please follow these steps:
git checkout -b feat/amazing-feature)git commit -m 'Add amazing feature')git push origin feat/amazing-feature)