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

Uploaded Python 3

File details

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

File metadata

  • Download URL: aws_ssm_env-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 bcfa7d285a4613c2cd1a29b53344d4f8395a5b106a3ae2c138856c97c7083c60
MD5 ce9d83e1f18b5243d7547a29b646c275
BLAKE2b-256 b7c7fdbcfaeb417726f37d14b39f8a4a91a6318c633905dfa7bfa6c5f0c1cd11

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aws_ssm_env-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9fd78372c92b3969884b723254d4a1cbd8c4f18f2be2546cb1adcd299d68c153
MD5 f6a1ea2f3f2f7ab71e710cce49e2fd24
BLAKE2b-256 bf176d147eb2a9d184c886fceb7c1e63aca2d961f90ff1816808c85a046127db

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