Skip to main content

A pathy wrapper around aws parameter store

Project description

waddle

the penguins api and tooling around aws's parameter store codebuild

ParamBunch

Lets you access secrets stored in a file or from parameter store!

From a file

Create a file called test.yml that will hold your config.
It can include both secrets and non-secrets

meta:
  kms_key: dev
  region: us-west-2
  profile: mycompany
aws.username: aws-user

Now add a secret to that file using the waddle cli

waddle -f /path/to/test.yml aws.password

waddle will prompt you to enter in the secret. As long as you have a kms key called dev, waddle will add a kms-data-key-encrypted secret into test.yml.

Now you can access configuration values in the test.yml configuration file using the following syntax:

from waddle import ParamBunch
conf = ParamBunch(filename='/path/to/test.yml')
AWS_USERNAME = conf.aws.username
AWS_PASSWORD = conf.get('aws.password', 'some default value')

But I want to use parameter store

You can also load configs straight from AWS parameter store by providing a prefix.

from waddle import ParamBunch
conf = ParamBunch(prefix='/path/to/parameters')
# Access /path/to/paramaters/aws/username
AWS_USERNAME = conf.aws.username

want to waddle your secrets up to SSM from a file?

In certain cases, you may want to keep files locally, but then push them to aws as part of CI/CD. For example, if you want to keep a centralized repository of your secrets that is shared among developers, you can encrypt secrets in your config files using waddle. For application deployment, you can push those files up to ssm using waddle deploy and/or delete them from ssm using waddle undeploy.

waddle deploy -f /path/to/params.yml
  • or -
waddle undeploy -f /path/to/params.yml

Bunch

A class that offers pathy semantics to access values in a dictionary.

Bunch -- general usage

e.g.,

from waddle import Bunch
values = {
    'a': {
        'b': {
            'c': True,
            'd': False,
        },        
    },
}
a = Bunch(values)
assert a.b.c == True
assert a.b.d == False
a.cat.name = 'mycat'
assert a['cat.name'] == 'mycat'
assert 'cat.age' in a == False
assert a.get('cat.age', 22) == 22
assert a.setdefault('cat.age', 45) == 45

Bunch -- env

You can use the built-in env function to use the dictionary as a set of default values that can be overridden by environment variables.

e.g.,

import os
from waddle import Bunch
os.environ['FTP_PASSWORD'] = 'password'
config = {
    'ftp': {
        'host': '127.0.0.1',
        'user': 'user',
    }
}
config = Bunch(config)
env = config.env()
assert env('FTP_PASSWORD') == 'password'
assert env('FTP_HOST') == '127.0.0.1'

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

waddle-1.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

waddle-1.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file waddle-1.0.tar.gz.

File metadata

  • Download URL: waddle-1.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.4

File hashes

Hashes for waddle-1.0.tar.gz
Algorithm Hash digest
SHA256 88b16aef2e7cbb866b663ab0b99a40188f9f9a2455d8be86fd420c8376c7ea17
MD5 efa8bbba1aa7e553885448b1709381fa
BLAKE2b-256 073c159b361f26391378cdc35ccd69c0e82769e6220458fccf2f01976a1ecb94

See more details on using hashes here.

File details

Details for the file waddle-1.0-py3-none-any.whl.

File metadata

  • Download URL: waddle-1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.4

File hashes

Hashes for waddle-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f2b2fb5904544aace2c9ba22eb92ccf9b189a2c3312cbc84efb15c8a04f3483f
MD5 f77534054045c582d25a0e2d5e16a3fb
BLAKE2b-256 051f7c5b7ebadc47fae6cdf99190990d83bd4b73b3aa04840e4d80d190e62343

See more details on using hashes here.

Supported by

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