Created
January 13, 2019 03:01
-
-
Save tgardiner/31672ab7fa0454e7422e982568c2d1de to your computer and use it in GitHub Desktop.
API Gateway Resource Policy to block Web Crawlers with wildcards
This file contains 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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": "execute-api:Invoke", | |
"Resource": "arn:aws:execute-api:{REGION}:{ACCOUNT_ID}:{API_NAME}/*" | |
}, | |
{ | |
"Effect": "Deny", | |
"Principal": "*", | |
"Action": "execute-api:Invoke", | |
"Resource": "arn:aws:execute-api:{REGION}:{ACCOUNT_ID}:{API_NAME}/*", | |
"Condition": { | |
"StringLike": { | |
"aws:UserAgent": [ | |
"*Googlebot*", | |
"*Google*", | |
"*Bingbot*", | |
"*Slurp*", | |
"*DuckDuckBot*", | |
"*Baiduspider*", | |
"*YandexBot*", | |
"*Sogou*", | |
"*Exabot*", | |
"*facebot*", | |
"*ia_archiver*" | |
] | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment