- Defined in:
AWS::S3 is a Ruby library for Amazon's Simple Storage Service's REST API (aws.amazon.com/s3). Full documentation of the currently supported API can be found at docs.amazonwebservices.com/AmazonS3/2006-03-01.
To get started you need to require 'aws/s3':
% irb -rubygems irb(main):001:0> require 'aws/s3' # => true
The AWS::S3 library ships with an interactive shell called s3sh. From within it, you have access to all the operations the library exposes from the command line.
% s3sh >> Version
Before you can do anything, you must establish a connection using Base.establish_connection!. A basic connection would look something like this:
AWS::S3::Base.establish_connection!( :access_key_id => 'abc', :secret_access_key => '123' )
The minimum connection options that you must specify are your access key id and your secret access key.
(If you don't already have your access keys, all you need to sign up for the S3 service is an account at Amazon. You can sign up for S3 and get access keys by visiting aws.amazon.com/s3.)
For convenience, if you set two special environment variables with the value of your access keys, the console will automatically create a default connection for you. For example:
% cat .amazon_keys export AMAZON_ACCESS_KEY_ID='abcdefghijklmnop' export AMAZON_SECRET_ACCESS_KEY='1234567891012345'
Then load it in your shell's rc file.
% cat .zshrc if [[ -f "$HOME/.amazon_keys" ]]; then source "$HOME/.amazon_keys"; fi
See more connection details at AWS::S3::Connection::Management::ClassMethods.
Defined Under Namespace
Modules:, , , , Classes: , , , , , , , , , , , , , , , , , , , , , , , , , ,
- UNSAFE_URI =
- Version =
[VERSION::MAJOR, VERSION::MINOR, VERSION::TINY, VERSION::BETA].compact * '.'
Class Method Summary (collapse)
Class Method Details
+ () escape_uri(path)
35 36 37
# File 'lib/aws/s3.rb', line 35 def self.escape_uri(path) URI.escape(path.to_s, UNSAFE_URI) end
+ () escape_uri_component(path)
39 40 41 42 43 44 45
# File 'lib/aws/s3.rb', line 39 def self.escape_uri_component(path) escaped = escape_uri(path) escaped.gsub!(/=/, '%3D') escaped.gsub!(/&/, '%26') escaped.gsub!(/;/, '%3B') escaped end