Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
List objects in an S3 bucket with no server-side encryption
require 'aws-sdk-s3'
client = Aws::S3::Client.new(region: 'us-west-2')
bucket = 'bucket1'
resp = client.list_objects(bucket: bucket)
resp.contents.each do |object|
metadata = client.head_object(bucket: bucket, key: object.key)
puts object.key unless metadata.server_side_encryption
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment