LootLens API
---
To enable RapidAPI request validation:
# Update Lambda environment variable
aws lambda update-function-configuration \
--function-name loot-lens-api-stack-LootLensFunction-XXXXX \
--environment "Variables={CACHE_TABLE_NAME=LootLensCache,RAPIDAPI_SECRET=your_secret_here}" \
--region ap-southeast-2
Get your Lambda function name:
aws lambda list-functions --region ap-southeast-2 --query "Functions[?contains(FunctionName, 'LootLens')].FunctionName"
In your RapidAPI dashboard:
---
| Resource | Limit | Purpose |
| Lambda Concurrency | 5 | Max simultaneous executions |
| Lambda Timeout | 5 seconds | Prevent slow attacks |
| DynamoDB Reads | 5 units/sec | ~5 strongly consistent reads/sec |
| DynamoDB Writes | 2 units/sec | ~2 writes/sec |
| Cache Duration | 30 minutes | Reduce Steam API calls |
---
Worst-case scenario (sustained abuse):
Monthly estimate with protection: $5-10 even under sustained attack
Without protection (previous setup): Potentially $100s-1000s
---
1. Enable RapidAPI Secret Validation
2. Monitor CloudWatch Alarms
3. Adjust Limits Based on Usage
```bash
# Deploy with custom limits
sam deploy --parameter-overrides \
RateLimitPerSecond=20 \
BurstLimit=50 \
LambdaConcurrency=10
```
4. Consider Adding WAF (Optional)
5. Set Up Budget Alerts
```bash
# Create AWS Budget for this stack
aws budgets create-budget \
--account-id YOUR_ACCOUNT_ID \
--budget file://budget.json
```
---
CloudWatch Dashboard: [View Logs](https://console.aws.amazon.com/cloudwatch/home?region=ap-southeast-2#logsV2:log-groups/log-group/$252Faws$252Fapigateway$252Flootlens-access-logs)
Check Alarm Status:
aws cloudwatch describe-alarms \ --alarm-names LootLens-HighInvocations LootLens-LambdaThrottles \ --region ap-southeast-2
View Recent API Calls:
aws logs tail /aws/apigateway/lootlens-access-logs --follow
---
Edit template.yaml parameters section:
Parameters:
RateLimitPerSecond:
Type: Number
Default: 10 # Change this
BurstLimit:
Type: Number
Default: 20 # Change this
LambdaConcurrency:
Type: Number
Default: 5 # Change this
Then redeploy:
sam build && sam deploy
---
1. RapidAPI handles rate limiting on their side, but these AWS protections are your last line of defense
2. Cache is critical: 30-minute cache duration means repeated requests for same item cost nothing
3. Monitor regularly: Check CloudWatch alarms weekly, especially after RapidAPI launch
4. DynamoDB provisioned capacity can be adjusted if you see throttling
---
If you see unexpected costs:
1. Immediately reduce concurrency:
```bash
aws lambda put-function-concurrency \
--function-name YOUR_FUNCTION_NAME \
--reserved-concurrent-executions 1 \
--region ap-southeast-2
```
2. Disable API temporarily:
```bash
aws apigatewayv2 delete-stage \
--api-id e6bxn9dw6b \
--stage-name $default \
--region ap-southeast-2
```
3. Check alarm history:
```bash
aws cloudwatch describe-alarm-history \
--alarm-name LootLens-HighInvocations \
--region ap-southeast-2
```
---
Last Updated: 2025-12-26
Stack Name: loot-lens-api-stack
Region: ap-southeast-2