class Aws::S3::Presigner


url = signer.presigned_url(:get_object, bucket: “bucket”, key: “key”)
signer = Aws::S3::Presigner.new
Example Use:
Allows you to create presigned URLs for S3 operations.

def initialize(options = {})

Options Hash: (**options)
  • :client (Client) -- Optionally provide an existing
def initialize(options = {})
  @client = options[:client] || Aws::S3::Client.new
end

def presigned_url(method, params = {})

Raises:
  • (ArgumentError) - Raises an ArgumentError if `:expires_in`

Options Hash: (**params)
  • :expires_in (Integer) -- The number of seconds

Parameters:
  • method (Symbol) -- Symbolized method name of the operation you want
def presigned_url(method, params = {})
  request = @client.build_request(method, params)
  request.handle(PresignHandler, step: :sign, priority: 99)
  expires_in = params.delete(:expires_in) || FIFTEEN_MINUTES
  validate_expires_in_header(expires_in)
  request.context[:presigned_expires_in] = expires_in
  request.send_request.data
end

def validate_expires_in_header(expires_in)

def validate_expires_in_header(expires_in)
  if(expires_in > ONE_WEEK)
    raise ArgumentError.new(
      "expires_in value of #{expires_in} exceeds one-week maximum"
    )
  end
end