Skip to content

UpdateIPSet

Source: src/AWS/WAFv2/UpdateIPSet.ts

Runtime binding for wafv2:UpdateIPSet — replace the bound IPSet’s address list at runtime (the classic dynamic block list: a Lambda appends offending IPs as it detects them). The binding reads the IP set for a fresh LockToken, applies the update, and retries optimistic-lock conflicts automatically.

Provide WAFv2.UpdateIPSetHttp on the hosting Lambda Function to satisfy the requirement.

// init — grants wafv2:GetIPSet + wafv2:UpdateIPSet on the IP set
const getIPSet = yield* AWS.WAFv2.GetIPSet(blockList);
const updateIPSet = yield* AWS.WAFv2.UpdateIPSet(blockList);
// runtime
const current = (yield* getIPSet()).IPSet?.Addresses ?? [];
yield* updateIPSet({ addresses: [...current, "192.0.2.7/32"] });