22.14.5. salt.fileserver.s3fs

The backend for a fileserver based on Amazon S3

See also

Salt File Server

This backend exposes directories in S3 buckets as Salt environments. This feature is managed by the fileserver_backend option in the Salt Master config.

S3 credentials can be set in the master config file like so:

s3.keyid: GKTADJGHEIQSXMKKRBJ08H
s3.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs

Alternatively, if on EC2 these credentials can be automatically loaded from instance metadata.

Additionally, s3fs must be included in the fileserver_backend config parameter in the master config file:

fileserver_backend:
  - s3fs

This fileserver supports two modes of operation for the buckets:

  1. A single bucket per environment

    s3.buckets:
      production:
        - bucket1
        - bucket2
      staging:
        - bucket3
        - bucket4
    
  2. Multiple environments per bucket

    s3.buckets:
      - bucket1
      - bucket2
      - bucket3
      - bucket4
    

Note that bucket names must be all lowercase both in the AWS console and in Salt, otherwise you may encounter SignatureDoesNotMatch errors.

A multiple-environment bucket must adhere to the following root directory structure:

s3://<bucket name>/<environment>/<files>

Note

This fileserver back-end requires the use of the MD5 hashing algorithm. MD5 may not be compliant with all security policies.

salt.fileserver.s3fs.dir_list(load)

Return a list of all directories on the master

salt.fileserver.s3fs.envs()

Return a list of directories within the bucket that can be used as environments.

salt.fileserver.s3fs.file_hash(load, fnd)

Return an MD5 file hash

salt.fileserver.s3fs.file_list(load)

Return a list of all files on the file server in a specified environment

salt.fileserver.s3fs.file_list_emptydirs(load)

Return a list of all empty directories on the master

salt.fileserver.s3fs.find_file(path, saltenv='base', env=None, **kwargs)

Look through the buckets cache file for a match. If the field is found, it is retrieved from S3 only if its cached version is missing, or if the MD5 does not match.

salt.fileserver.s3fs.serve_file(load, fnd)

Return a chunk from a file based on the data received

salt.fileserver.s3fs.update()

Update the cache file for the bucket.

Docs for previous releases are available on salt.rtfd.org.

Latest Salt release: 2014.1.13

Try the shiny new release candidate of Salt, v2014.7.0rc6! More info here.

Previous topic

22.14.4. salt.fileserver.roots

Next topic

22.14.6. salt.fileserver.svnfs

SaltStack News

Upcoming SaltStack events, webinars and local meet ups and user groups.