API 执行权限的 IAM 策略示例
有关许可模型和其他背景信息,请参阅 针对调用 API 的访问控制。
以下策略语句将为带 a123456789
标识符的 API 授予在 test
阶段沿 mydemoresource
路径调用任何 POST 方法的用户权限,并假定已将相应的 API 部署至 AWS 区域 us-east-1:
- JSON
-
-
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"execute-api:Invoke"
],
"Resource": [
"arn:aws:execute-api:us-east-1:*:a123456789/test/POST/my-demo-resource-path/*"
]
}
]
}
以下示例策略语句将在已部署相应 API 的任何 petstorewalkthrough/pets
区域为带 a123456789
标识符的 API 授予在任何阶段沿 AWS 资源路径调用任意方法的用户许可:
- JSON
-
-
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"execute-api:Invoke"
],
"Resource": [
"arn:aws:execute-api:*:*:a123456789/*/*/petstorewalkthrough/pets"
]
}
]
}