Skip to main content

Allows you to read parameters from AWS Parameter Store and operate on results as on dictionary.

Project description

SSMEnv

master develop PyPI Python Licence
Build Status Build Status PyPI

SSMEnv allows you to read parameters from AWS Parameter Store and operate on results as on dictionary.

Installation

You have to have boto3 installed then you can just run:

pip install ssmenv

Read parameters

Reading parameters is as simply as initialising class object.

from ssmenv import SSMEnv

ssmenv = SSMEnv(("/service/my-service", "/resource/dynamodb"))

# Accessing parameters
debug = ssmenv["SERVICE_MY_SERVICE_DEBUG"]

# As it's dictionary we can also:

# 1. Get list of all loaded parameter's names
list(ssmenv.keys())

# 2. Get list of all loaded parameter's values
list(ssmenv.values())

# and so on.

Populate os.environ

You can hide use of SSMEnv by using os.environ dict.

import os
from ssmenv import SSMEnv

os.environ = {**os.environ, **SSMEnv("/service/my-service")}

Remove common prefixes

Accessing your parameters through whole namespaces can sometimes be not convenient especially if you have very long names.

Hence why you can use prefixes parameter, to make your code cleaner.

from ssmenv import SSMEnv

ssmenv = SSMEnv(("/service/my-service",), prefixes=("/service/my-service",))
ssmenv["DEBUG"]

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

ssmenv-1.0.1.tar.gz (15.4 kB view hashes)

Uploaded Source

Built Distribution

ssmenv-1.0.1-py3-none-any.whl (4.7 kB view hashes)

Uploaded Python 3

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