gpt4 book ai didi

amazon-web-services - s3 策略允许在同一语句中使用多个 IP

转载 作者:行者123 更新时间:2023-12-04 00:12:44 25 4
gpt4 key购买 nike

我试图允许从 3 个指定的 IP 地址连接到存储桶。当我以这种方式添加它们时:

{
"Version": "2008-10-17",
"Id": "S3PolicyId1",
"Statement": [
{
"Sid": "IPDeny",
"Effect": "Deny",
"Principal": {
"AWS": "*"
},
"Action": "s3:*",
"Resource": "arn:aws:s3:::bucket/*",
"Condition": {
"NotIpAddress": {
"aws:SourceIp": "ip1",
"aws:SourceIp": "ip2",
"aws:SourceIp": "ip3"
}
}
}
]
}

保存后仅保留三行中的一行,因此我只能设置一个 IP。知道如何在不长时间添加新语句和解决方法的情况下做到这一点吗?

最佳答案

{
"Version": "2008-10-17",
"Id": "testPolicy",
"Statement": [

{
"Sid": "1",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucketname/subfolder/subfolder2/*",
"Condition": {
"IpAddress": {
"aws:SourceIp": [
"xxx.xxx.xxx.xxx/32",
"xxx.xxx.xxx.xxx/32"
]
}
}
}

]
}

关于amazon-web-services - s3 策略允许在同一语句中使用多个 IP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36618285/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com