Migrate sellers to native CloudFront + WAF x402 monetization#37
Draft
arditti wants to merge 6 commits into
Draft
Migrate sellers to native CloudFront + WAF x402 monetization#37arditti wants to merge 6 commits into
arditti wants to merge 6 commits into
Conversation
…ending The AWS WAF AI traffic monetization capability is generally available (configurable via the WAF console and API today). Only the MonetizationConfig / Monetize fields in the released CloudFormation / CDK / SDK (and Terraform AWS provider) are still pending, expected to follow shortly. Reword comments/docs accordingly: the L1 addPropertyOverride (or commented HCL) is the supported way to set these fields until the typed props land — not a 'preview'/'inert' workaround.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Front the AI-content + gateway sellers with native CloudFront + WAF x402 monetization
AWS now supports AI-traffic monetization natively in CloudFront + WAF. This PR fronts
both seller surfaces (
serverless/AI-content API andagentic/payment gateway) withCloudFront + a WAF WebACL and removes the in-app x402 verify/settle middleware.
Changes
serverless/lib/waf-monetization.ts) + unit tests.discovery, per-tier Monetize).
/generatesplit into/generate-text(×1) and/generate-image(×20) off a $0.002base so WAF can price by URI prefix;
/estimatestays free.IaC support status
AWS WAF AI traffic monetization is GA; the
Monetizeaction +MonetizationConfigare not yet in the released CloudFormation/CDK (SDK/CFN support expected to follow
shortly). They are applied via L1
addPropertyOverrideso both stacks deploy theWebACL with the monetization fields set verbatim, to be simplified to native props once
they land.
Note
WAF fixed tiers can't reproduce true per-token pricing; text/image tiers are
representative and
/estimateremains free for price discovery.✅ Validated against the official AWS spec
Checked against the AWS WAF AI traffic monetization docs (getting started, pricing):
MonetizationConfigshape:CryptoConfig.PaymentNetworks[]withChain/WalletAddress/Prices[{Amount,Currency}]+CurrencyMode— matches.Chain=BASE_SEPOLIAandCurrencyMode=TESTare valid test-mode values (production =BASE/SOLANA+REAL).Monetizeis a terminating action gated to bot traffic via Bot Control labels (human-allow runs first), per the docs’ guidance to avoid 402-ing human visitors.PriceMultiplieris a per-rule string; effective price = base × multiplier.⛔ Do not merge yet (gating)
AWS WAF AI traffic monetization is GA, but the
Monetizeaction +MonetizationConfigare not yet exposed by the IaC tooling this repo uses (released CloudFormation/CDK/SDK, or the Terraform AWS provider) — that support is expected to follow shortly. Opened as a draft. Merge only once:Until then this is a reviewable reference; the WebACL deploys, and the monetization fields are set via the supported L1
addPropertyOverrideescape hatch.