Skip to main content

A lightweight utility to fetch AWS SSM parameters and inject them as environment variables using JSON.

Project description

aws-ssm-env

Fetch environment configurations from AWS SSM Parameter Store as JSON. Supports both AWS environments and local development via IAM role assumption.

Installation

pip install aws-ssm-env

Prerequisites

  • The SSM parameter must be of type String (not StringList or SecureString unless you're decrypting).
  • The value of the parameter must be a valid JSON object string. For example:
{
  "DB_HOST": "localhost",
  "DB_USER": "admin",
  "DB_PASS": "secret"
}

Usage

1. In AWS environment (e.g., EC2, Lambda)

If your code is running in an AWS environment with appropriate IAM permissions, you only need to provide the region and parameter name:

from aws_ssm_env.ssm import get_env_parameters_from_ssm

env_config = get_env_parameters_from_ssm(
    account_id="",  # Optional
    region="us-west-2",
    role_name="",  # Optional
    parameter_name="/my/app/env"
)

print(env_config["DB_HOST"])

2. From local environment (with role assumption)

Use this method when working locally and you need to access parameters from another AWS account:

from aws_ssm_env.ssm import get_env_parameters_from_ssm

env_config = get_env_parameters_from_ssm(
    account_id="123456789012",
    region="us-west-2",
    role_name="MyRole",
    parameter_name="/my/app/env"
)

print(env_config["DB_HOST"])

License

MIT

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

aws_ssm_env-0.1.2.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

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

aws_ssm_env-0.1.2-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file aws_ssm_env-0.1.2.tar.gz.

File metadata

  • Download URL: aws_ssm_env-0.1.2.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.12 Linux/6.8.0-60-generic

File hashes

Hashes for aws_ssm_env-0.1.2.tar.gz
Algorithm Hash digest
SHA256 529f08b8214e3aba28a9cf3f7d9cf08bfbc94c3de7e45575a09dd9f276953f3b
MD5 896fbd9e69263637d889ea03e86cd21b
BLAKE2b-256 bfca4fcfe4195ed343b2b67ef954641e59bb83ae6f2d6793407a6d23373db058

See more details on using hashes here.

File details

Details for the file aws_ssm_env-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: aws_ssm_env-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.12 Linux/6.8.0-60-generic

File hashes

Hashes for aws_ssm_env-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 447944bd762e17da136ea4e75c9a9c1cb39b1ffbf68569cc211d3ee1ed7b3e82
MD5 463ec82dbdcc0bd05899fd8376271c14
BLAKE2b-256 ec1dc81174d2175346bc3ff099a5bee1948263f338238790f23e9ff1e452dd7f

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