Created
February 25, 2021 12:14
-
-
Save roccoblues/0b2305cf399a82b8dc0fa6e2c8e5175e to your computer and use it in GitHub Desktop.
example script for https://github.com/aws/aws-sdk-ruby/issues/2482
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'aws-sdk' | |
region = | |
access_key_id = | |
secret_access_key = | |
account_id = | |
accesspoint = | |
key = 'foo' | |
new_key = 'bar' | |
bucket_arn = "arn:aws:s3:#{region}:#{account_id}:accesspoint/#{accesspoint}" | |
client = Aws::S3::Client.new( | |
region: region, | |
access_key_id: access_key_id, | |
secret_access_key: secret_access_key | |
) | |
object = Aws::S3::Object.new(bucket_arn, key, client: client) | |
puts object.exists? | |
object.move_to(bucket: bucket_arn, key: new_key) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment