A Pythonic wrapper library for AWS SSM Parameter Store with enhanced error handling, existence testing, idempotent operations, and comprehensive tag management.
Project description
Welcome to simple_aws_ssm_parameter_store Documentation
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simple_aws_ssm_parameter_store-0.1.1.tar.gz.
File metadata
- Download URL: simple_aws_ssm_parameter_store-0.1.1.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
419aff7a8e65d2e88a3489871a0a809970ffd1ad29fd3c5dcf1db5d5d00b3143
|
|
| MD5 |
e0e47ec13d1c2a27c620b7ab0f24d8e2
|
|
| BLAKE2b-256 |
127bbd40356a376a2a7d6f01cb4f1eaab3838b357717d4a4e26444e175160684
|
File details
Details for the file simple_aws_ssm_parameter_store-0.1.1-py3-none-any.whl.
File metadata
- Download URL: simple_aws_ssm_parameter_store-0.1.1-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bc35fd5024b1ccc69e810e1c313f16e1525812072c723e15d4f4776819495e6
|
|
| MD5 |
6b553894cba96f8c6340641106151d1f
|
|
| BLAKE2b-256 |
a3d06f2f82921044cd07e4cbe78503e0ac0dfa8735115158aa53e87f8a07ec9c
|