1

I want to change the files of a bucket (all files) to private, so i'm wondering how to do it with aws-shell. I think that maybe the mv command can be useful to achieve this, but i cant figure out how to use it, because this is the first time that i use aws-shell.

Edit 1

I tried using s3 mv s3://bucket s3://temporary --recursive --acl private, but i needed to create another temporary bucket to make the swap. Because of this error:

Cannot mv a file onto itself [...]

Is there a way to do this without creating a temporary bucket? I mean that this could cause charges for having transactions and space being used by duplicate files

UselesssCat
  • 2,248
  • 4
  • 20
  • 35

1 Answers1

3

You can copy the files onto themselves and change the Access Control List.

Test it out, but it would be something like:

aws s3 cp s3://bucket s3://bucket --recursive --acl private

Keep the source and destination the same.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470