Learn how to integrate Google's Gemma 4 models on Amazon Bedrock. Code examples for text, images, reasoning mode, streaming, and tool calling.

Learn how to set up AWS WAF AI Traffic Monetization. Charge AI scraper bots per request using USDC payments on Base or Solana with CloudFront.

AI bots and agents are flooding websites and APIs, consuming valuable content and data without paying. If you run a content site, API, or dataset, this free usage can hurt your revenue and server costs.
AWS WAF now solves this problem. With AI Traffic Monetization, you can charge AI clients directly at the edge using real micro-payments. When a bot requests your content, it gets a clear "pay to access" response. The bot pays in USDC, and your content is delivered only after payment is confirmed.
This feature uses an open standard, works globally on CloudFront, and adds no extra cost beyond standard WAF pricing. You keep full control and get paid straight to your wallet.
AWS WAF AI Traffic Monetization is an edge-routing feature that allows web owners to charge AI scraper bots and API clients in USDC before serving protected content. When a bot requests a resource without paying, the WAF returns an HTTP 402 Payment Required response containing wallet addresses and network details, prompting the bot to execute an on-chain transaction to get access.
The process follows a clean request flow:
Key benefits:
You can monetize any content delivered through CloudFront:
MonetizationConfig to define your payment settings.Here is a basic MonetizationConfig example:
{
"MonetizationConfig": {
"CurrencyMode": "REAL",
"CryptoConfig": {
"PaymentNetworks": [
{
"Chain": "BASE",
"WalletAddress": "0x1234567890abcdef1234567890abcdef12345678",
"Prices": [
{
"Amount": "0.001",
"Currency": "USDC"
}
]
}
]
}
}
}Start with CurrencyMode: "TEST" to validate everything using testnet funds. Switch to "REAL" when ready for live payments.
Always combine Monetize with Bot Control labels to avoid affecting human users.
Example rule (JSON):
{
"Name": "MonetizeBotsOnly",
"Priority": 5,
"Statement": {
"LabelMatchStatement": {
"Scope": "LABEL",
"Key": "awswaf:managed:aws:bot-control:bot"
}
},
"Action": {
"Monetize": {}
}
}Human traffic passes through normally. Only labeled bots see the payment challenge.
| Chain | Network | Currency | Purpose |
|---|---|---|---|
| BASE | Base mainnet | USDC | Production |
| SOLANA | Solana mainnet | USDC | Production |
| BASE_SEPOLIA | Base Sepolia testnet | USDC | Testing |
| SOLANA_DEVNET | Solana Devnet | USDC | Testing |
Set a base price in your MonetizationConfig (minimum $0.001 USDC per request).
Use PriceMultiplier on individual rules to adjust pricing. For example:
Common strategies:
Use the built-in dashboard to track:
Payments settle directly to your wallet. AWS does not touch the funds.
Pair monetization with RSL (Really Simple Licensing) in your robots.txt or via CloudFront response headers so agents know exactly how they may use your content.
1. Do human visitors get blocked?
No. Use Bot Control labels so only AI bots receive the 402 payment challenge. Humans continue accessing content normally.
2. What is the minimum price per request?
$0.001 USDC. You can go higher with multipliers.
3. Which blockchains are supported?
Base and Solana for production, with testnets for development.
4. When does the client actually pay?
Payment is verified before content is fetched and settled only after a successful 2xx response from your origin.
5. Can I offer free access to certain bots?
Yes. Use the Allow action for verified search engines or partners.
6. How much extra latency does it add?
A few seconds only for requests that perform payment processing. Normal traffic is unaffected.
7. What happens if settlement fails?
The client receives an error and can retry. No content is served until payment succeeds.
8. Do I need special client software?
Any agent that supports the open x402 protocol can pay. Popular runtimes already work.
Tags