Local AWS Mock for Python – Mock SSM Parameter Store and extendable AWS services
Project description
Local AWS Mock - Python Package (pyawsmock)
A lightweight Python package that mocks AWS services locally for development and testing. Currently, supports AWS Systems Manager (SSM) Parameter Store.
This package extends boto3 and automatically delegates calls to real AWS when the region is not a local mock region.
Key Features
- Local vs AWS Delegation
- Regions starting with
local-*use the local mock store. - Other regions delegate calls directory to
boto3for real AWS services.
- Regions starting with
- Persistent or Temporary Storage
- Persistent Mode: Provide a directory path to store the configurations for local mock across sessions.
- Temporary Mode: Uses a temporary directory (
tempfile) and supportscleanup()to remove temporary data.
- Versioning & Labels
- Supports multiple versions per SSM parameter.
- Mock implementation of labels per version.
- Tracks modification history for audit purposes.
- SecureString Support
- Values are stored as
base64encoded strings. - Supports
WithDecryption=Truefor retrieval.
- Values are stored as
- Filters & Pagination
- Supports filters (Type, KeyId, Label) for relevant SSM operations.
- Handles
MaxResultsandNextTokenfor paginated responses.
- Audit History
- Tracks the IAM user/role performing operations (currently defaults to
mock-user). - Timestamps modifications for audit purposes.
- Tracks the IAM user/role performing operations (currently defaults to
- ARNs & Account IDs
- Uses
arn:mockinstead ofarn:awsto clearly differentiate local mock resources. - Default AWS Account ID is
000000000000for all mock ARNs.
- Uses
Current Limitations
- Unsupported AWS Features
- Config
- CloudTrail
- IAM (Users, Groups, Roles, Policies - permissions are not enforced)
- Authentication
- Default Assumptions
- All operations assume a single mock IAM user (
mock-user). - Regions are either
local-*for mock or real AWS regions for delegation.
- All operations assume a single mock IAM user (
These limitations may be addressed in future versions.
Supported Services (Current)
| Service | Methods |
|---|---|
| SSM (Parameter Store) | put_parameter, get_parameter, get_parameters, delete_parameter, label_parameter_version, unlabel_parameter_version, describe_parameters, get_parameters_by_path, get_parameter_history |
Additional AWS services will be supported in future releases.
Installation
From PyPI
pip install pyawsmock
From GitHub
pip install git+https://github.com/coldsofttech/pyawsmock.git
Dependencies
boto3~=1.40.55filelock~=3.20.0
boto3is required to delegate calls to real AWS.
Usage Example
from pyawsmock import configure_mock, client, cleanup_mock
configure_mock(mode="persistent", path="./local_aws") # Persistent storage example
configure_mock(mode="temporary") # Temporary storage example
ssm = client("ssm", region_name="local-eu-west-1") # eu-west-1 region local mock for SSM
ssm.put_parameter(
Name="/test/key",
Value="test_value",
Type="String"
)
response = ssm.get_parameter(Name="/test/key")
print(response["Parameter"]["Value"]) # Output: test_value
cleanup_mock() # Only applicable for 'temporary' mode
Future Plans
- Extend to additional AWS services such as:
- DynamoDB, S3, Lambda, CloudWatch, etc.
- Improved IAM user/role matching and permission enforcement.
- Enhanced logging, auditing, and multi-account support.
- Full AWS API coverage for supported services.
- Support for Config, CloudTrail, and authentication workflows.
License
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 pyawsmock-0.1.0.tar.gz.
File metadata
- Download URL: pyawsmock-0.1.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e0ec6d6698eafc29242140bec13690d283eaf5d93b56bf567c6806bf41e403e
|
|
| MD5 |
70400e46698b8ea910c7352069139aa9
|
|
| BLAKE2b-256 |
71c3cbb02120c46d612f71dbd4a752ecc48a16e6982c2dcd9c86705dc7b4b192
|
File details
Details for the file pyawsmock-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pyawsmock-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50f65f42d4dbc5550f4a873cd2176698cdbe01b1469db0732fa383a8b6dac023
|
|
| MD5 |
62692f15991302d7d5b664a3f10df380
|
|
| BLAKE2b-256 |
35ebc3514e203b7efd4986a03c39c33be9bcda7cbb128d5f308f20507f570ed3
|