简体   繁体   English

通过 AWS Powershell 工具向存储桶中的所有对象授予权限?

[英]Granting permission to ALL objects in a bucket via AWS Powershell Tools?

I can grant specific permissions to a specific file easily, like this:我可以轻松地向特定文件授予特定权限,如下所示:

Set-S3ACL -BucketName "bucket" -Key "file.txt"

However, now I'm trying to do it for all the files:但是,现在我正在尝试对所有文件执行此操作:

Set-S3ACL -BucketName "bucket" -Key "*"

This does not work and it throws:这不起作用,它会抛出:

Set-S3ACL : The specified key does not exist.

What is the valid syntax in this case?这种情况下的有效语法是什么?

If you need to recursively apply the function to every file, you can achieve that with Get-ChildItem to get all of the files in a folder, and using Recurse to also search subfolders.如果您需要递归地将 function 应用于每个文件,您可以使用Get-ChildItem来获取文件夹中的所有文件,并使用Recurse来搜索子文件夹。 Then loop those results and call the function for each one.然后循环这些结果并为每个结果调用 function。

Get-ChildItem -Path $topfolder -Recurse | ForEach-object { Set-S3ACL -BucketName "bucket" -Key $_.Name }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何默认公开 AWS S3 存储桶中的所有对象? - How to make all Objects in AWS S3 bucket public by default? 如何通过 PowerShell 的 AWS 工具获取分段上传 (AWS S3) 的每个部分的校验和? - How to get checksums of each part of a multipart upload (AWS S3) via AWS Tools for PowerShell? AWS S3 存储桶访问文件权限 - AWS S3 Bucket Access file permission 如何通过 python boto3 列出 aws s3 存储桶中的所有文件夹 - How to list all folders inside aws s3 bucket via python boto3 如何使用适用于 Delphi 的 Appercept AWS SDK 获取存储桶中的对象列表? - How to get list of objects in bucket, using Appercept AWS SDK for Delphi? 无法通过传输连接到 S3 存储桶,只能通过 AWS CLI - Cannot connect to S3 bucket via Transmit, only via AWS CLI https 通过云端和 AWS 的 S3 存储桶不起作用 - https via cloudfront and S3 bucket of AWS doesn't work 如何限制对 AWS s3 存储桶的所有访问 - How to restrict all access to the AWS s3 bucket 无法通过 FTP 删除 AWS EC2 上的文件,权限被拒绝 - Cannot delete files on AWS EC2 via FTP, permission denied AWS:使用 lambda function 读取 Amazon S3 存储桶中的所有文件 - AWS: Reading all files in an Amazon S3 bucket with a lambda function
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM