Sha256: f1bd57c3fff547b96b852a06ad78b1b386033d53f119546465ec44c9d797247f

Contents?: true

Size: 1.42 KB

Versions: 13

Compression:

Stored size: 1.42 KB

Contents

### S3 Usage examples

N.B. This gem solves very specific and limited use cases, and is in no way exhaustive (although it may be easily monkey patched to add in additional functions)

#### Configuration

Create a file named .aws_buckets in your root home directory.  This file is a simple lookup allowing you to reference S3 buckets by key, e.g.

```
---
:bucket_1_key: "name of bucket 1 in S3"
:bucket_2_key: "name of bucket 2 in S3"
```

#### Writing to a bucket

```
aws_clients = ::AwsClient::Container.new(ORG_KEY, AWS_REGION, PROVISIONING_REGION)
s3_client = aws_clients.s3
s3_client.write_file_to_bucket(bucket_key, path_to_local_file)
```

#### Find or create a bucket by bucket key

```
  aws_clients = ::AwsClient::Container.new(ORG_KEY, AWS_REGION, PROVISIONING_REGION)
  s3_client = aws_clients.s3
  s3_client.find_or_create_bucket_for(bucket_key)
```

Note that when creating an S3 bucket, it will be named in the following format: [bucket key].[aws credentials key].[aws region]

#### Accessing the underlying client

```
  aws_clients = ::AwsClient::Container.new(ORG_KEY, AWS_REGION, PROVISIONING_REGION)
  s3_client = aws_clients.s3
  underlying_client = s3_client.client
```

#### Extending functionality with a patch:

Extend the following class:

```
  module AwsClient
    class S3Wrapper < AwsClient::Wrapper

      ...

    end
  end
```


See 'Accessing the underlying client', above, for how to access the underlying S3 client.

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
aws_client-0.1.3 documentation/s3.md
aws_client-0.1.2 documentation/s3.md
aws_client-0.1.1 documentation/s3.md
aws_client-0.0.93 documentation/s3.md
aws_client-0.0.92 documentation/s3.md
aws_client-0.0.91 documentation/s3.md
aws_client-0.0.9 documentation/s3.md
aws_client-0.0.8 documentation/s3.md
aws_client-0.0.7 documentation/s3.md
aws_client-0.0.6 documentation/s3.md
aws_client-0.0.5 documentation/s3.md
aws_client-0.0.4 documentation/s3.md
aws_client-0.0.3 documentation/s3.md