Skip to main content

psread

Quick, simple AWS Parameter Store CLI for listing/reading params with tab completion

screen recording of psread usage example

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:

  1. Bump the version in psread.py and update the Changelog.

  2. python setup.py sdist && python setup.py bdist_wheel

  3. twine upload dist/*

  4. git push

  5. 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

Metadata

Release files for psread 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for psread 0.1.2
File Size Uploaded
psread-0.1.2.tar.gz 8.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for psread 0.1.2
File Interpreter ABI Platform
psread-0.1.2-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 29.2 kB

Release files / psread-0.1.2.tar.gz

Download URL psread-0.1.2.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e5aa73bfb67eb14c871158bf8f64fdbe167d0fb73259e816c68e75c1d2a0713b
BLAKE2b-256 checksum
How to use checksums
795ac69f20a26f0e4e7faaa380a27467970d178a76a86e6116be4988f80cab8e
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / psread-0.1.2-py2.py3-none-any.whl

Download URL psread-0.1.2-py2.py3-none-any.whl
Size 20.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
13b1cec67ee620c0a039de28b3a1301034cffba7e38593dd6543bfef8fb1bf83
BLAKE2b-256 checksum
How to use checksums
cc8c5f5f557e6071e37ad4c9bc1497b0a89c5a6337c08ddaf97e9dc56aeeba33
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page