How to make multiple files in Amazon S3 public?

0 votes

I have a folder in a bucket with multiple files. There seems to be no way to upload them and make them public straight away. So I uploaded them all, they're private, and I need to make them all public.

I've tried the aws console, it just gives an error though it works fine with works fine with folders with fewer files.

I've tried using S3 organizing in Firefox, same thing.

Is there some software or some script I can run to make all these public?

Oct 17, 2018 in AWS by datageek
• 2,440 points
54 views

1 answer to this question.

0 votes

I had to change several hundred thousand objects. I launched an EC2 instance to run this, which makes it all go faster. You'll want to install the aws-sdk first.

require 'aws-sdk'

Aws.config.update({
  region: 'REGION_CODE_HERE',
  credentials: Aws::Credentials.new(
    'ACCESS_KEY_ID_HERE',
    'SECRET_ACCESS_KEY_HERE'
  )
})
bucket_name = 'BUCKET_NAME_HERE'

s3 = Aws::S3::Resource.new
s3.bucket(bucket_name).objects.each do |object|
  puts object.key
  object.acl.put({ acl: 'public-read' })
end
answered Oct 17, 2018 by Archana
• 4,090 points

Related Questions In AWS

+1 vote
1 answer

How to combine multiple S3 objects in the target S3 object w/o leaving S3

"However sometimes our raw objects are not ...READ MORE

answered Aug 28, 2018 in AWS by Priyaj
• 56,160 points
1,347 views
+3 votes
5 answers

How to move files from amazon ec2 to s3 bucket using command line

First Option sm3cmd Use s3cmd s3cmd get s3://AWS_S3_Bucket/dir/file Take a ...READ MORE

answered Aug 29, 2018 in AWS by Priyaj
• 56,160 points
1,443 views
0 votes
1 answer

In Amazon Data Pipeline, how to make sure only once instance of a pipeline is running at any time?

On the CopyTablesActivity, you could set a lateAfterTimeout attribute ...READ MORE

answered Sep 19, 2018 in AWS by Priyaj
• 56,160 points
192 views
0 votes
1 answer

How to upload an object into Amazon S3 in Lambda?

I suspect you are calling the context.done() function before s3.upload() has ...READ MORE

answered Sep 27, 2018 in AWS by Archana
• 4,090 points
34 views
+13 votes
2 answers
+1 vote
2 answers

AWS CloudWatch Logs in Docker

The awslogs works without using ECS. you need to configure ...READ MORE

answered Sep 6, 2018 in AWS by bug_seeker
• 15,310 points
275 views
0 votes
2 answers

How to access files in S3 bucket from R?

You can take a look at the ...READ MORE

answered Aug 10, 2018 in AWS by Deepthi
• 300 points
591 views
0 votes
1 answer

How do you concatenate small sized files in Amazon S3?

Amazon S3 does not provide a concatenate ...READ MORE

answered Sep 3, 2018 in AWS by Archana
• 4,090 points
628 views