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

Publishing

  • Bump version in setup.py and kinghorn/__init.py__ and run ./publish.sh

Configuration

Configuration is handled with environment variables, as follows:

  • 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

  • publish.sh - Helper script to publish to PyPI
  • setup.py - Metadata for publishing packages
  • .gitignore - Files to ignore for git
  • kinghorn/__main__.py - Basic validation script for module
  • kinghorn/__init__.py - Exports all public functions
  • kinghorn/kinghorn.py - The library
  • kinghorn/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.7.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

kinghorn-0.0.7-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for kinghorn-0.0.7.tar.gz
Algorithm Hash digest
SHA256 6f95d5ec2ba8729916c2205b11df0daadd82eeefd209a6ef55bbd705bd0dbdcc
MD5 62ac86ccb6710d430fd8fc9d9fe84899
BLAKE2b-256 79e5251561b82d7852785263bc8899aca1eea9e91a169904c68f26dcb535843c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kinghorn-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 6.2 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/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for kinghorn-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 fbe400dad4dab137d305eae440458ed12e5620c624b94ac9ac1e089704d9947a
MD5 dfc20363791d48f1821156d67feba1cc
BLAKE2b-256 759a10d1c332631aaabff98a2408b338ed691d029c73fb0168f24ef9bcd57044

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