Skip to main content

A Pythonic wrapper library for AWS SSM Parameter Store with enhanced error handling, existence testing, idempotent operations, and comprehensive tag management.

Project description

Documentation Status https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project/actions/workflows/main.yml/badge.svg https://codecov.io/gh/MacHu-GWU/simple_aws_ssm_parameter_store-project/branch/main/graph/badge.svg https://img.shields.io/pypi/v/simple-aws-ssm-parameter-store.svg https://img.shields.io/pypi/l/simple-aws-ssm-parameter-store.svg https://img.shields.io/pypi/pyversions/simple-aws-ssm-parameter-store.svg https://img.shields.io/badge/✍️_Release_History!--None.svg?style=social&logo=github https://img.shields.io/badge/⭐_Star_me_on_GitHub!--None.svg?style=social&logo=github
https://img.shields.io/badge/Link-API-blue.svg https://img.shields.io/badge/Link-Install-blue.svg https://img.shields.io/badge/Link-GitHub-blue.svg https://img.shields.io/badge/Link-Submit_Issue-blue.svg https://img.shields.io/badge/Link-Request_Feature-blue.svg https://img.shields.io/badge/Link-Download-blue.svg

Welcome to simple_aws_ssm_parameter_store Documentation

https://simple-aws-ssm-parameter-store.readthedocs.io/en/latest/_static/simple_aws_ssm_parameter_store-logo.png

simple_aws_ssm_parameter_store is a Pythonic wrapper library for AWS SSM Parameter Store that enhances the standard boto3 client with better error handling, existence testing, idempotent operations, and comprehensive tag management. Instead of dealing with exceptions for missing parameters or complex tag operations, this library provides intuitive functions that return meaningful values and handle edge cases gracefully.

Quick Tutorial

1. Parameter Existence Testing

Check if a parameter exists without handling exceptions. The function returns None for non-existent parameters instead of raising ParameterNotFound exceptions.

import boto3
from simple_aws_ssm_parameter_store.api import get_parameter

ssm_client = boto3.client("ssm")

# Test if parameter exists
param = get_parameter(ssm_client, "/app/database/host")
if param is not None:
    print(f"Parameter exists with value: {param.value}")
else:
    print("Parameter does not exist")

2. Idempotent Parameter Deletion

Delete parameters safely without worrying about whether they exist. The function returns True if deletion occurred, False if the parameter didn’t exist.

from simple_aws_ssm_parameter_store import delete_parameter

# Safe to call multiple times
deleted = delete_parameter(ssm_client, "/app/temp/config")
if deleted:
    print("Parameter was deleted")
else:
    print("Parameter didn't exist")

# Call again - no exception raised
deleted = delete_parameter(ssm_client, "/app/temp/config")
print(f"Second deletion attempt: {deleted}")

3. Comprehensive Tag Management

Manage parameter tags with intuitive functions for getting, updating, and replacing tags.

from simple_aws_ssm_parameter_store.api import (
    get_parameter_tags,
    update_parameter_tags,
    put_parameter_tags,
    remove_parameter_tags
)

# Get all tags (returns empty dict if no tags)
tags = get_parameter_tags(ssm_client, "/app/config")
print(f"Current tags: {tags}")

# Add/update specific tags (partial update)
update_parameter_tags(ssm_client, "/app/config", {
    "Environment": "production",
    "Team": "platform"
})

# Replace all tags (full replacement)
put_parameter_tags(ssm_client, "/app/config", {
    "Environment": "production",
    "Owner": "alice"
})

# Remove specific tags
remove_parameter_tags(ssm_client, "/app/config", ["Team"])

# Remove all tags
put_parameter_tags(ssm_client, "/app/config", {})

Expected output progression:

Current tags: {}
After update: {"Environment": "production", "Team": "platform"}
After replacement: {"Environment": "production", "Owner": "alice"}
After removal: {"Environment": "production", "Owner": "alice"}
After clearing: {}

4. Working with Parameter Objects

Access parameter metadata through a rich Parameter object with convenient properties.

# Create a parameter first
ssm_client.put_parameter(
    Name="/app/database/password",
    Value="secret123",
    Type="SecureString"
)

# Get parameter with decryption
param = get_parameter(ssm_client, "/app/database/password", with_decryption=True)

print(f"Name: {param.name}")
print(f"Value: {param.value}")
print(f"Type: {param.type}")
print(f"Version: {param.version}")
print(f"Is SecureString: {param.is_secure_string_type}")
print(f"ARN: {param.arn}")

Expected output:

Name: /app/database/password
Value: secret123
Type: SecureString
Version: 1
Is SecureString: True
ARN: arn:aws:ssm:us-east-1:123456789012:parameter/app/database/password

Install

simple_aws_ssm_parameter_store is released on PyPI, so all you need is to:

$ pip install simple-aws-ssm-parameter-store

To upgrade to latest version:

$ pip install --upgrade simple-aws-ssm-parameter-store

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

simple_aws_ssm_parameter_store-0.1.1.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

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

simple_aws_ssm_parameter_store-0.1.1-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for simple_aws_ssm_parameter_store-0.1.1.tar.gz
Algorithm Hash digest
SHA256 419aff7a8e65d2e88a3489871a0a809970ffd1ad29fd3c5dcf1db5d5d00b3143
MD5 e0e47ec13d1c2a27c620b7ab0f24d8e2
BLAKE2b-256 127bbd40356a376a2a7d6f01cb4f1eaab3838b357717d4a4e26444e175160684

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for simple_aws_ssm_parameter_store-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7bc35fd5024b1ccc69e810e1c313f16e1525812072c723e15d4f4776819495e6
MD5 6b553894cba96f8c6340641106151d1f
BLAKE2b-256 a3d06f2f82921044cd07e4cbe78503e0ac0dfa8735115158aa53e87f8a07ec9c

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