Specifies a resource policy for a REST API. To learn more about resource policies, see Control access to a REST API with API Gateway resource policies. For resource policy examples, see API Gateway resource policy examples.
x-amazon-apigateway-policy
example
The following example specifies a resource policy for a REST API. The
resource policy denies (blocks) incoming traffic to an API from a specified source
IP address block. On import, "execute-api:/*"
is converted to
arn:aws:execute-api:
,
using the current Region, your AWS account ID, and the current REST API
ID.region
:account-id
:api-id
/*
"x-amazon-apigateway-policy": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": "*", "Action": "execute-api:Invoke", "Resource": [ "execute-api:/*" ] }, { "Effect": "Deny", "Principal": "*", "Action": "execute-api:Invoke", "Resource": [ "execute-api:/*" ], "Condition" : { "IpAddress": { "aws:SourceIp": "
192.0.2.0/24
" } } } ] }