Saya mengalami sedikit kesukaran untuk membuat direktori pada AWS S3 menggunakan Flysystem - Saya terus mendapat AccessDenied
响应。我的存储桶具有所有公共访问权限 blocked
, tetapi dasar baldi membenarkan pengguna membuat permintaan untuk melakukan segala-galanya mengenainya:
{ "Version": "2008-10-17", "Id": "PolicyForCloudFrontPrivateContent", "Statement": [ { "Sid": "AllowCloudFrontServicePrincipal", "Effect": "Allow", "Principal": { "Service": "cloudfront.amazonaws.com" }, "Action": "s3:GetObject", "Resource": "arn:aws:s3:::my-local-bucket/*", "Condition": { "StringEquals": { "AWS:SourceArn": "arn:aws:cloudfront::***:distribution/***" } } }, { "Sid": "2", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::***:user/local" }, "Action": "s3:*", "Resource": "arn:aws:s3:::my-local-bucket/*" } ] }
Dan local
Dasar Pengguna saya:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:*", "s3-object-lambda:*" ], "Resource": "*" } ] }
Saya boleh memuat naik fail langsung tiada masalah - hanya direktori, mis. images/blog
等,我收到 LeagueFlysystemUnableToWriteFile::atLocation
pengecualian dan membuang ralat berikut:
Error executing "PutObject" on "https://s3.eu-west-2.amazonaws.com/my-local-bucket/images/blog/"; AWS HTTP error: Client error: `PUT https://s3.eu-west-2.amazonaws.com/my-local-bucket/images/blog/` resulted in a `403 Forbidden` response: <?xml version="1.0" encoding="UTF-8"?> <Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>***(truncated...) AccessDenied (client): Access Denied - <?xml version="1.0" encoding="UTF-8"?> <Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>***</RequestId><HostId>***</HostId></Error>
Tahukah anda apa puncanya?
Selepas beberapa minggu cuba mencari jawapan, saya mendapati bahawa jika saya lulus
visibility
作为private
melalui konfigurasi semasa mencipta pemacu s3, maka ia berfungsi seperti yang diharapkan.