Quick, simple AWS Parameter Store CLI for listing/reading params with tab completion
Project description
Quick, simple AWS Parameter Store CLI for listing/reading params with tab completion
Background
The AWS-provided tools for using Parameter Store (the web UI and awscli) are fine if you know exactly what you’re trying to find. They’re not so good if you’re… looking… for something, and want to explore your Parameter Store parameters like a filesystem, or hierarchical datastore. This is a dead-simple, quick, and rather ugly hack of a CLI built in Python and largely inspired by the Hashicorp Vault CLI, plus shell completion for parameter paths. This doesn’t write parameters or do other “fancy” things. It’s mainly intended for teams who are also using Parameter Store to replace human-centered secret stores (i.e. Vault, KeePass, random encrypted files, etc.) and often have only a vague idea of the exact parameter name they’re looking for.
Status
This is a somewhat-tipsy Friday evening quarantine project. There are (it’s almost painful to write this) no unit tests, and it’s largely cargo-culted from previous work of mine. I’ll gladly accept PRs assuming they look correct, meet PEP8/PyFlakes style, and are relatively straightforward and working. That’s about the end of “support”.
Requirements
This project requires Python 3.6 or later, as it makes use of both PEP484 type hints and PEP498 f-strings. It also requires boto3, argcomplete, and appdirs.
Installation
psread can be installed with pip install psread or python -mpip install psread
To set up autocompletion in your shell, either activate global completion for argcomplete, or for bash, set up completion for this project specifically. To do that in just your current shell:
eval "$(psread --bash-wrapper)"
To do that permanently (recommended):
echo -e "eval \"\$($(which psread) --bash-wrapper)\"" >> ~/.bashrc
Usage
There are two main functionalities: listing parameters and reading parameters. Shell tab completion is included, primarily for bash, via the argcomplete package.
$ psread -h
usage: psread [-h] [-v] [-w] [-V] [-R] [--called-from-wrapper] [{ls,list,read,get}] [PARAM]
Quick, simple AWS Parameter Store CLI for listing/reading params with tab completion
positional arguments:
{ls,read,get} Action to perform
PARAM Parameter (or parameter path) to list or read
optional arguments:
-h, --help show this help message and exit
-v, --verbose verbose output. specify twice for debug-level output.
-w, --bash-wrapper print bash wrapper function to STDOUT and exit
-V, --version Print version number and exit
-R, --recache re-cache parameters for this region of this account
--called-from-wrapper
DO NOT USE
Parameter Caching
psread caches the Names (and only the names) of all parameters in each region of each account that you use it with; this is effectively required for sane tab-completion speeds. The parameters are cached in a Pickle file at a platform-specific path, which can be seen in the psread -V output. This path can be overridden with the PSREAD_CACHE_PATH environment variable, which should specify the absolute path to write the pkl file at.
By default, parameter names are cached for 86400 seconds (1 day); this can be overridden by setting the PSREAD_CACHE_TTL environment variable to an integer cache TTL in seconds.
Re-caching of the current region of the current account can be forced by running psread with the -R or --recache option.
Debugging
In order to enable debug logging before normal command-line options and arguments are parsed, such as during tab completion: export PSREAD_LOG=DEBUG
Release Process
Completely manual right now:
Bump the version in psread.py and update the Changelog.
python setup.py sdist && python setup.py bdist_wheel
twine upload dist/*
git push
git tag -s -a X.Y.Z -m 'X.Y.Z released YYYY-mm-dd' && git tag -v X.Y.Z && git push origin X.Y.Z
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file psread-0.1.2.tar.gz
.
File metadata
- Download URL: psread-0.1.2.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5aa73bfb67eb14c871158bf8f64fdbe167d0fb73259e816c68e75c1d2a0713b |
|
MD5 | a61e3df49fb451682fa381795c8108ea |
|
BLAKE2b-256 | 795ac69f20a26f0e4e7faaa380a27467970d178a76a86e6116be4988f80cab8e |
File details
Details for the file psread-0.1.2-py2.py3-none-any.whl
.
File metadata
- Download URL: psread-0.1.2-py2.py3-none-any.whl
- Upload date:
- Size: 20.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13b1cec67ee620c0a039de28b3a1301034cffba7e38593dd6543bfef8fb1bf83 |
|
MD5 | da177e8627c75a2f7819d7e7a1ab3cb7 |
|
BLAKE2b-256 | cc8c5f5f557e6071e37ad4c9bc1497b0a89c5a6337c08ddaf97e9dc56aeeba33 |