2 Answers
- Newest
- Most votes
- Most comments
1
Hello
you could do something like
make all uploaded files public
aws s3 sync . s3://my-bucket/path --acl public-read
the cp command also allows the use of the --acl and it may use other values like public-read-write or bucket-owner-full-control
aws s3 cp s3://mybucket/test.txt s3://mybucket/test2.txt --acl public-read-write
https://docs.aws.amazon.com/cli/latest/userguide/cli-services-s3-commands.html
https://docs.aws.amazon.com/cli/latest/reference/s3/cp.html#examples
hope this helps
RT
answered 5 years ago
0
Thanks, I found I missed AWS_DEFAULT_REGION=cn-north-1, that made it returns Invalid Token
I solved my problem by:
1 Added AWS_DEFAULT_REGION before run my command
2 Allowed S3:PubObjectAcl to my role:
{
"Sid": "Stmt2",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws-cn:iam::AccountB-ID:role/MyPutObjectRole"
},
"Action": ["s3:PutObject","s3:PutObjectAcl"],
"Resource": "arn:aws-cn:s3:::MyPublicBucket/*"
}
3 use:
aws s3 cp xxx.txt s3://myPublicBucket --acl public-read
answered 5 years ago
Relevant content
- asked 2 months ago
- asked a month ago
- asked 9 months ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 3 months ago