Skip to main content

Command-line tool to interact with s3 bucket as a key/value store

Project description

kvs3

kvs3 is a tool for managing environment configuration values. It is intended for use with aws environments and uses an s3
bucket as a general key/value store.

Installing

$ pip install kvs3

Authenticating

kvs3 assumes running in an environment with an authenticated AWS user which has the appropriate permission to read/write
values to an s3 bucket used as the key/value store. Uses boto3 authentication method hierarchy in attempting aws access.

Setting up s3

Any s3 bucket can be used, but recommend configuring a bucket with versioning and server-side encryption. Kvs3 will use
the following sources (in order) to determine the s3 bucket name:

  • --bucket flag included in parameters
  • shell Environment var KVS3_BUCKET
  • Run $ kvs3 init and provide bucket name. Written to .kvs3 file used by kvs3 to find bucket

Usage

Writing Keys

$ kvs3 write <service> <key> <value|->

This command will write a value to a key in s3 under the service path.

Example:

$ kvs3 --bucket my-key-value-store write my-app-env min-nodes 3

Will create an object in the s3 bucket named my-key-value-store with the name my-app-env/min-nodes and the contents 3.

Listing Keys

$ kvs3 list <service>
KEY           SIZE  MODIFIED
min-nodes     3     2019-06-27 23:37:48
max-nodes     10    2019-06-30 23:28:52

list will show the key names for a given service, along with other the size in bytes of the value and the date when
the key was last modified.

Reading Keys

$ kvs3 read <service> <key>
`read` outputs the value of a single configuration key.

Setting shell environment with multiple key values

The setenv command is used as part of a deployment pipeline to setup runtime environment variables for use in a
deployment pipeline. Create a keyfile with a simple list of key values, such as:

$ cat <<EOF > env.vars
MIN_NODES
MAX_NODES
DOCKER_REGISTRY

Now, use setenv to create the output used by bash source to define Environment variables.

$ kvs3 setenv my-app-env env.vars > local.env

Results in local.env containing the following example contents:

# source my-app-env environment config  
export MIN_NODES=3
export MAX_NODES=5
export DOCKER_REGISTRY=quay.io

This file can be used $source local.env in a linux environment to create the environment configuration values used
by a deployment pipeline.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kvs3-0.0.5.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

kvs3-0.0.5-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file kvs3-0.0.5.tar.gz.

File metadata

  • Download URL: kvs3-0.0.5.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for kvs3-0.0.5.tar.gz
Algorithm Hash digest
SHA256 1582cc40e53a7406b60ad77938e3ff734bf340a0d03a376f73b9c9547dc63be8
MD5 a8b8de565121c2180c528d9a30fcd1e0
BLAKE2b-256 56638a9173d0998605e9af6ba512d2df48de838272b26e89d81869202a244831

See more details on using hashes here.

File details

Details for the file kvs3-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: kvs3-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for kvs3-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b170aa7f27e7877d2a8e2d4ff62c2de33ecb1b9c816508fd3c47b73d1db907db
MD5 20da7238bde47ff3dfe2334ce80aca4f
BLAKE2b-256 bcae936aceaf497e29adce14481ab684002d5313d9c768f8ff67b74d863cbc0d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page