x-amazon-apigateway-policy
为 REST API 指定资源策略。要了解有关资源策略的更多信息,请参阅 使用 API Gateway 资源策略控制对 API 的访问。有关资源策略示例,请参阅 API Gateway 资源策略示例。
x-amazon-apigateway-policy
示例
以下示例为 REST API 指定资源策略。此资源策略拒绝(阻止)从指定的源 IP 地址块到 API 的传入流量。导入时,将使用当前区域、您的AWS账户 ID 和当前 REST API ID 将 "execute-api:/*"
转换为 arn:aws:execute-api:
。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
" } } } ] }