Skip to content

darkskyapp/s3_put-cookbook

 
 

Repository files navigation

s3_put cookbook

A library cookbook for the s3_put resource, which uploads a file to S3.

Requirements

  • An AWS account
  • An S3 bucket
  • AWS credentials
  • s3:PutObject permissions for what path(s) you want to upload to on the aforementioned S3 bucket

Usage

Add a dependency on this cookbook to your cookbook’s metadata or Berksfile.

Then, in your recipe, to upload a file:

s3_put 'path/to/my/file.tar.gz' do
  bucket            'my_bucket'
  remote_path       '/path/on/s3'
  access_key_id     'access_key_id'
  secret_access_key 'secret_access_key'
  action            :upload
end

Note that the resultant path will be the remote_path combined with the filename you are uploading. For this example, that would be #{remote_path}/file.tar.gz.

The access_key_id and secret_access_key are optional; credentials will be picked up per the AWS SDK from a user’s credentials file or an instance role if you do not provide the credentials directly.

Conversely, to delete one:

s3_put 'path/to/my/file.tar.gz' do
  bucket            'my_bucket'
  remote_path       '/path/on/s3'
  access_key_id     'access_key_id'
  secret_access_key 'secret_access_key'
  action            :delete
end

Author

Author:: Eric Herot [email protected]
Author:: Jeff Byrnes [email protected]

About

Library cookbook for uploading files to S3

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%