除了可以在AWS网关调用API端点的用户之外,是否有一种方法/策略可以拒绝所有用户?
目前使用的政策:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::account_id:user/user-name"
},
"Action": "execute-api:Invoke",
"Resource": "arn:aws:execute-api:region:account_id:api_to_be_invoked/*/*"
}
]
}
我在API网关的资源策略中应用了上述策略并进行了部署,但是为了进行测试,我尝试使用另一个管理用户的访问权限和秘密密钥通过Postman投递,但它仍然成功地使用了,这是我不想要的。
有什么帮助吗?
发布于 2019-08-08 14:53:59
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"NotPrincipal": {
"AWS":
[ "arn:aws:iam::account_id:user/user-name",
"arn:aws:iam::account_id:root"
]
},
"Action": "execute-api:Invoke",
"Resource": "arn:aws:execute-api:region:account_id:api_to_be_invoked/*/*"
}
]
}
发布于 2019-08-08 17:30:34
您试过使用IAM策略条件吗?我还没有在生产环境中试过,但应该能满足你的需要。
{"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Action": "execute-api:Invoke",
"Resource": "arn:aws:execute-api:region:account_id:api_to_be_invoked/*/*",
"Condition": {
"StringNotEquals" : {
"aws:username" : "your_user_name"
}
}
}
]}
如果这个答案有帮助,请告诉我。
https://stackoverflow.com/questions/57414633
复制相似问题