Skip to content

Instantly share code, notes, and snippets.

@tombeynon
Created March 8, 2017 14:10
Show Gist options
  • Save tombeynon/88e1139f28245c104f47a97e94113850 to your computer and use it in GitHub Desktop.
Save tombeynon/88e1139f28245c104f47a97e94113850 to your computer and use it in GitHub Desktop.
Update ACL for all files in a bucket
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment