gpt4 book ai didi

AWS S3 Bucket Permissions(AWS S3存储桶权限)

转载 作者:bug小助手 更新时间:2023-10-24 17:55:07 26 4
gpt4 key购买 nike



I want images I uploaded to S3 bucket "fat" (Created two folders under it /men/shoes) to be accessed via url on internet - For UI JSON.

我希望我上传到S3存储桶“胖”(在它下面创建了两个文件夹/男人/鞋子)的图片可以通过互联网上的url访问-用于UI JSON。


I have added bucket policy and CORS but I am getting access denied. What else should I consider.

我添加了存储桶策略和CORS,但访问被拒绝。我还应该考虑什么。


{
"Version": "2012-10-17",
"Id": "Policy1694408177441",
"Statement": [
{
"Sid": "Stmt1694408172843",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::395811947099:root"
},
"Action": [
"s3:GetObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::fat/*",
"arn:aws:s3:::fat"
]
},
{
"Sid": "S3PolicyStmt-DO-NOT-MODIFY-1694409137710",
"Effect": "Allow",
"Principal": {
"Service": "logging.s3.amazonaws.com"
},
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::fat/*"
}
]
}

CORS:

CORS:


[
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"GET"
],
"AllowedOrigins": [
"https://fat.s3.us-west-1.amazonaws.com"
],
"ExposeHeaders": []
},
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"GET"
],
"AllowedOrigins": [
"https://fat.s3.us-west-1.amazonaws.com"
],
"ExposeHeaders": []
},
{
"AllowedHeaders": [],
"AllowedMethods": [
"GET"
],
"AllowedOrigins": [
"*"
],
"ExposeHeaders": []
}
]

更多回答
优秀答案推荐

Change the Principal to * in your bucket policy in order to grant everyone over the internet access to you bucket objects.

在您的存储桶策略中将主体更改为*,以便允许每个人通过互联网访问您的存储桶对象。


{
"Sid": "Stmt1694408172843",
"Effect": "Allow",
"Principal": "*", <-- Update Principal here
"Action": [
"s3:GetObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::fat/*",
"arn:aws:s3:::fat"
]
},
..
..
..


Do you really need s3:ListBucket action? If not, you can remove this action to adhere with the least privileges principal.

您真的需要S3:ListBucket操作吗?如果不是,您可以删除此操作以遵循最低权限原则。


更多回答

Perfect Ankush !

完美的安库什!

Please accept the answer if it has helped you.

如果答案对你有帮助,请接受它。

@AnkushJain Please check this could you help in this issue stackoverflow.com/questions/77111957/…

@AnkushJain请查看此信息您能否在本期中提供帮助Stackoverflow.com/Questions/77111957/…

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