Skip to main content

Cache AWS resources

Project description

Kinghorn

Python 3 library for caching AWS resources

Purpose

This library provides caching of AWS resources, which can save development time and money making API calls, as well as reduce the chances of errors taking place from running scripts against resources in flux. I use it to cache resources such as EC2 instances, volumes, and snapshots for retrieval in later scripts. I disliked having to call an API and perform an O(n^2) operation to unwrap my instance metadata every time I did something with boto3. With Kinghorn I can easily place resources in dictionaries for constant time access.

Opinions

I've chosen to discard metadata and "unwrap" entity metadata for storage. I've used clients instead of resources for Kinghorn to make it easy to alter the library to access low level API functions if needed. The library expects appropriate credentials in ~/.aws/credentials.

Installation instructions for Mac OS X

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
brew install python curl -O http://python-distribute.org/distribute_setup.py python distribute_setup.py
curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
python get-pip.py
pip3 install boto3 python3 -m kinghorn

Configuration

Configuration is handled with environment variables, as follows:

  • KINGHORN_REGION - Which region you want to use
  • KINGHORN_ENVIRONMENT - Which environment your API credentials are for, for example factory, production, etc.
  • KINGHORN_LOGGING_OUT - Set to 1 to log to std out, useful for local testing and debugging
  • KINGHORN_LOGGING_LEVEL
  • KINGHORN_LOGGING_FILE
  • KINGHORN_CACHE_LOCATION

Files

  • kinghorn.py - The library
  • test_kinghorn.py - An example file describing some ways to use the library and testing all functions

Future feature ideas

  • Additional entities for different services in AWS as I need them
  • Automated configurable cache expiration
  • Passthrough to the AWS API on cache miss

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

kinghorn-0.0.6.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

kinghorn-0.0.6-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file kinghorn-0.0.6.tar.gz.

File metadata

  • Download URL: kinghorn-0.0.6.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.11.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.16

File hashes

Hashes for kinghorn-0.0.6.tar.gz
Algorithm Hash digest
SHA256 67d214ffbfae777677ff1f9b8578b2f1cdccac3a3ab8d2b858d90652d54a0037
MD5 ef60de28d5c3d7b7b07729640e285e91
BLAKE2b-256 e90453e73ea554139c620ca182377437999abd7883e697531a458e2ab2505423

See more details on using hashes here.

File details

Details for the file kinghorn-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: kinghorn-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.11.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.16

File hashes

Hashes for kinghorn-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c6467b67ba83114ca71cacd80df57ed845a0ef040854165653f4408050f21876
MD5 92c3678a1b65f7d7cb48fed32b744ab4
BLAKE2b-256 180c615620ebfe12227603c679307b00a255967cc05df749c1e58d6c283c5e8f

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