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.3.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.3-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aws_ssm_env-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 31b01612c65e896301ff0d1ec6586fe875e6b28006e5d76ad88168e8bea18d73
MD5 5d248aecaee31fdc21e794de292257a2
BLAKE2b-256 3e1ade7d33535796285b70564f1f7e382b8352ec34ddd454f481b426cab146ab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aws_ssm_env-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 925bac6ed3e9f7d8043d489f9477a54eee3c2737c759f71a074766b4b408f081
MD5 fd13bc6fb8b9356cdc034ef9a745dc5d
BLAKE2b-256 2c46e2d39e6f270aaede95ac0f3aaebbbaf40ac4fc9a8f99852f3829fd4a2645

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