| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
The following tasks guide you through using the AWS SDK for Ruby to send authenticated requests using your AWS Account credentials or IAM user credentials.
Making Requests Using Your AWS Account or IAM user Credentials
|
1 |
Create an instance of the |
|
2 |
Make a request to Amazon S3 by enumerating objects in a bucket using the
|
The following Ruby code sample demonstrates the preceding tasks.
# Get an instance of the S3 interface using the specified credentials configuration. s3 = AWS::S3.new( :access_key_id => my_access_key_id, :secret_access_key => my_secret_key) # Get a list of all object keys in a bucket. bucket = s3.buckets[bucket_name].objects.collect(&:key) puts bucket
Note
You can create the AWS:S3 client without providing your security
credentials. Requests sent using this client are anonymous requests, without a
signature. Amazon S3 returns an error if you send anonymous requests for a resource
that is not publicly available.
For working examples, see Working with Amazon S3 Objects and Working with Amazon S3 Buckets. You can test these examples using your AWS Account or IAM user credentials.