Skip to main content

Imports Amazon SSM Parameter Store values into CKAN config

Project description

PyPI version Tests

ckanext-ssm-config - Amazon SSM Config CKAN Extension

About

This plugin enables CKAN config options to be retrieved at runtime from AWS Parameter Store.

This is particularly useful for automatically managed environments, so that dynamic or secret values such as the Beaker session key, XLoader job tokens, or Google reCAPTCHA private keys, can be stored securely outside the configuration management system.

Unfortunately the current CKAN architecture does not allow for database passwords to be handled by this plugin, as the password is read from the config before this plugin has the chance to inject it.

Queensland Government has developed this plugin to be used with data.qld.gov.au and publications.qld.gov.au.

Features

  • Config values with SSM Parameter Store placeholders, ${ssm:/path/to/value} or {{ssm:/path/to/value}}, will be replaced at runtime.
  • Values that cannot be retrieved from the Parameter Store will result in blanks, or a fallback value can be supplied, eg {{ssm:/path/to/value:default_value}}
  • All SSM parameters under a prefix can be automatically converted into config entries.

Requirements

  • boto3

Compatibility with core CKAN versions:

CKAN version Compatibility
2.7 no longer supported
2.8 no longer supported
2.9 yes
2.10 yes
2.11 yes
master yes*

*Testing occurs against 'master' in non-failing mode, do verify test summary. At of April 2025 it was passing, so we are confident it is 2.12 compatible.

Configuration

ckan.plugins = ssm_config

IAM permissions similar to the following are needed:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "ssm:GetParameter",
                "ssm:GetParameters",
                "ssm:GetParametersByPath"
            ],
            "Resource": [
                "arn:aws:ssm:*:*:parameter/CKAN/config/",
                "arn:aws:ssm:*:*:parameter/CKAN/config/*",
            ],
            "Effect": "Allow"
        }
    ]
}

Optional:

ckanext.ssm_config.region_name = <region>
ckanext.ssm_config.prefix = /CKAN/config/
ckanext.ssm_config.aws_access_key_id = abcde
ckanext.ssm_config.aws_secret_access_key = ABCDE

If region_name is not configured, the extension will attempt to query AWS metadata to determine the region of the machine where CKAN is running.

If prefix is configured, the extension will attempt to load all parameters under this prefix as config entries, with slashes being converted to dots. For example, if the prefix is set to /CKAN/config/, and the SSM Parameter Store contains the key /CKAN/config/sqlalchemy/url, then the extension will populate config['sqlalchemy.url'] with the SSM value.

If aws_access_key_id and aws_secret_access_key are not configured, the extension will proceed on the assumption that permissions are being managed through an EC2 instance role.

Development

To install this plugin for development:

  1. Activate your Python virtual environment, eg . /usr/lib/ckan/default/bin/activate

  2. Install the plugin and its dependencies:

    git clone https://github.com/qld-gov-au/ckanext-ssm-config.git
    cd ckanext-ssm-config
    pip install -e .
    pip install -r requirements.txt -r dev-requirements.txt
    

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

ckanext_ssm_config-0.1.1.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

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

ckanext_ssm_config-0.1.1-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file ckanext_ssm_config-0.1.1.tar.gz.

File metadata

  • Download URL: ckanext_ssm_config-0.1.1.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ckanext_ssm_config-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fad1319e4e7f775e3e85f8551ceed01b69f6e14f40d9951b6abd1ee59fbf3e67
MD5 d4bbb9770b5f92b00ecbf2fa221ba7b2
BLAKE2b-256 0cc62137c24c3ccc2cafac87f7dcec1c9ddaa3df767ba4633e08c4c36678e108

See more details on using hashes here.

Provenance

The following attestation bundles were made for ckanext_ssm_config-0.1.1.tar.gz:

Publisher: publish.yml on qld-gov-au/ckanext-ssm-config

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ckanext_ssm_config-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ckanext_ssm_config-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b8dd2277df0adda00d8dbd831aee1ff4ac56d4c87418f10147158806f253d670
MD5 bd29e2feae3ca2688e1bc8730b7eeb3c
BLAKE2b-256 423ef011f9e835b3cc536da44e98c838ec550f51cd4974d7fc0051e4bb3db2ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for ckanext_ssm_config-0.1.1-py3-none-any.whl:

Publisher: publish.yml on qld-gov-au/ckanext-ssm-config

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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