Menu
Amazon Simple Storage Service
Developer Guide (API Version 2006-03-01)

Making Requests Using AWS Account or IAM User Credentials - AWS SDK for Ruby

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 AWS::S3 class.

2

Make a request to Amazon S3 by enumerating objects in a bucket using the buckets method of AWS::S3. The client generates the necessary signature value from your credentials and includes it in the request it sends to Amazon S3.

The following Ruby code sample demonstrates the preceding tasks.

Copy
# Get an instance of the S3 interface using the specified credentials configuration. s3 = AWS::S3.new() # 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.