Description:
Hi, I am trying to ssh a linux server and from that I am trying to upload a file to S3 bucket using AWS cli, and its working fine.
AWS S3 cp /path/to/file s3://sample_bucket --profile=user1
Problem:
But while uploading the file, i want to make that file public too. Is there any command to make the file public, if so then please correct the above given command.
If you select Write objects, then anyone can upload, overwrite, or delete objects that are in the bucket. If you select Read bucket permissions, then anyone can view the bucket's ACL. If you select Write bucket permissions, then anyone can change the bucket's ACL.
By default, new S3 bucket settings do not allow public access, but customers can modify these settings to grant public access using policies or object-level permissions.
By default, all Amazon S3 buckets and objects are private. Only the resource owner which is the AWS account that created the bucket can access that bucket. The resource owner can, however, choose to grant access permissions to other resources and users.
Before you can upload files to an Amazon S3 bucket, you need write permissions for the bucket. For more information about access permissions, see Identity and access management in Amazon S3. You can upload any file type—images, backups, data, movies, etc.
You can set the Access Control List (ACL) while copying an object. So your command would become.
aws s3 cp /path/to/file s3://sample_bucket --acl public-read
You'll also want to check the buckets Permissions tab and review the Manage public access control lists (ACLs) settings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With