x-amazon-apigateway-policy - Amazon API Gateway
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

x-amazon-apigateway-policy

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:region:account-id:api-id/*, using the current Region, your Amazon account ID, and the current REST 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" } } } ] }