Name | pyawsmock JSON |
Version |
0.1.1
JSON |
| download |
home_page | None |
Summary | Local AWS Mock for Python – Mock SSM Parameter Store, S3, and extendable AWS services |
upload_time | 2025-10-21 12:31:25 |
maintainer | None |
docs_url | None |
author | coldsofttech |
requires_python | >=3.10 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 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** and **Amazon S3**, including file uploads, downloads, object retrieval, and
bucket metadata configuration.
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 `boto3` for real AWS services.
- **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 supports `cleanup()` to remove temporary data.
- **Audit History**
- Tracks the IAM user/role performing operations (currently defaults to `mock-user`).
- Timestamps modifications for audit purposes.
- **ARNs & Account IDs**
- Uses `arn:mock` instead of `arn:aws` to clearly differentiate local mock resources.
- Default AWS Account ID is `000000000000` for all mock ARNs.
- **SSM Parameter Store Local Mock**
- **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 `base64` encoded strings.
- Supports `WithDecryption=True` for retrieval.
- **Filters & Pagination**
- Supports filters (Type, KeyId, Label) for relevant SSM operations.
- Handles `MaxResults` and `NextToken` for paginated responses.
- **S3 Local Mock**
- **Buckets & Objects**
- Create and manage buckets and objects locally.
- **Checksum Support**
- Supports `MD5`, `SHA1`, `SHA256`, `CRC32`, `CRC32C`, `CRC64NVME`.
- **Upload & Download**
- Mimics boto3 `upload_file`, `download_file` with callbacks.
- **StreamingBody**
- Implements `MockStreamingBody` similar to `botocore`.
- **Transfer Simulation**
- Supports `MockS3Transfer` and `MockS3TransferConfig` to mimic `S3Transfer` behaviour.
- **Bucket Metadata Configuration**
- Create, update, retrieve, and delete bucket metadata configuration.
- **Object Retrieval**
- Supports `get_object` with conditional headers, byte ranges, SSE-C mock headers, and realistic response
structure.
- **Default Behaviour**
- Handles versioning (default to `1`), delete markers, storage class, and request payer defaults.
- **Persistent Storage**
- Stores uploaded files locally for retrieval and S3-like object metadata.
## Current Limitations
- **Unsupported AWS Features**
- Config
- CloudTrail
- IAM (Users, Groups, Roles, Policies - permissions are not enforced)
- Authentication
- S3 Object Lambda
- Multi-part downloads via `get_object` or `PartNumber`.
- Full versioning support for S3 (local mock uses default version `1`)
- **Default Assumptions**
- All operations assume a single mock IAM user (`mock-user`).
- Regions are either `local-*` for mock or real AWS regions for delegation.
> 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` |
| S3 | `create_bucket`, `create_bucket_metadata_configuration`, `get_bucket_metadata_configuration`, `update_bucket_metadata_inventory_table_configuration`, `update_bucket_metadata_journal_table_configuration`, `delete_bucket_metadata_configuration`, `upload_file`, `download_file`, `get_object` |
> Additional AWS services will be supported in future releases.
## Installation
### From PyPI
```bash
pip install pyawsmock
```
### From GitHub
```bash
pip install git+https://github.com/coldsofttech/pyawsmock.git
```
#### Dependencies
- `boto3~=1.40.55`
- `filelock~=3.20.0`
- `crcmod~=1.7`
> `boto3` is required to delegate calls to real AWS.
## Usage Example
```python
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.
- Multi-part S3 upload/download and versioning support.
## License
[MIT License](LICENSE)
Raw data
{
"_id": null,
"home_page": null,
"name": "pyawsmock",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": null,
"author": "coldsofttech",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/0f/64/6e3ca8391b56d6995c363d3fd7bef425de73d1334fe14187a40651e6e704/pyawsmock-0.1.1.tar.gz",
"platform": null,
"description": "# Local AWS Mock - Python Package (`pyawsmock`)\n\nA lightweight Python package that **mocks AWS services locally** for development and testing. Currently, supports **AWS\nSystems Manager (SSM) Parameter Store** and **Amazon S3**, including file uploads, downloads, object retrieval, and\nbucket metadata configuration.\n\nThis package **extends boto3** and automatically delegates calls to real AWS when the region is not a local mock region.\n\n## Key Features\n\n- **Local vs AWS Delegation**\n - Regions starting with `local-*` use the **local mock store**.\n - Other regions delegate calls directory to `boto3` for real AWS services.\n- **Persistent or Temporary Storage**\n - **Persistent Mode:** Provide a directory path to store the configurations for local mock across sessions.\n - **Temporary Mode:** Uses a temporary directory (`tempfile`) and supports `cleanup()` to remove temporary data.\n- **Audit History**\n - Tracks the IAM user/role performing operations (currently defaults to `mock-user`).\n - Timestamps modifications for audit purposes.\n- **ARNs & Account IDs**\n - Uses `arn:mock` instead of `arn:aws` to clearly differentiate local mock resources.\n - Default AWS Account ID is `000000000000` for all mock ARNs.\n- **SSM Parameter Store Local Mock**\n - **Versioning & Labels**\n - Supports multiple versions per SSM parameter.\n - Mock implementation of labels per version.\n - Tracks modification history for audit purposes.\n - **SecureString Support**\n - Values are stored as `base64` encoded strings.\n - Supports `WithDecryption=True` for retrieval.\n - **Filters & Pagination**\n - Supports filters (Type, KeyId, Label) for relevant SSM operations.\n - Handles `MaxResults` and `NextToken` for paginated responses.\n- **S3 Local Mock**\n - **Buckets & Objects**\n - Create and manage buckets and objects locally.\n - **Checksum Support**\n - Supports `MD5`, `SHA1`, `SHA256`, `CRC32`, `CRC32C`, `CRC64NVME`.\n - **Upload & Download**\n - Mimics boto3 `upload_file`, `download_file` with callbacks.\n - **StreamingBody**\n - Implements `MockStreamingBody` similar to `botocore`.\n - **Transfer Simulation**\n - Supports `MockS3Transfer` and `MockS3TransferConfig` to mimic `S3Transfer` behaviour.\n - **Bucket Metadata Configuration**\n - Create, update, retrieve, and delete bucket metadata configuration.\n - **Object Retrieval**\n - Supports `get_object` with conditional headers, byte ranges, SSE-C mock headers, and realistic response\n structure.\n - **Default Behaviour**\n - Handles versioning (default to `1`), delete markers, storage class, and request payer defaults.\n - **Persistent Storage**\n - Stores uploaded files locally for retrieval and S3-like object metadata.\n\n## Current Limitations\n\n- **Unsupported AWS Features**\n - Config\n - CloudTrail\n - IAM (Users, Groups, Roles, Policies - permissions are not enforced)\n - Authentication\n - S3 Object Lambda\n - Multi-part downloads via `get_object` or `PartNumber`.\n - Full versioning support for S3 (local mock uses default version `1`)\n- **Default Assumptions**\n - All operations assume a single mock IAM user (`mock-user`).\n - Regions are either `local-*` for mock or real AWS regions for delegation.\n\n> These limitations may be addressed in future versions.\n\n## Supported Services (Current)\n\n| Service | Methods |\n|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| 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` |\n| S3 | `create_bucket`, `create_bucket_metadata_configuration`, `get_bucket_metadata_configuration`, `update_bucket_metadata_inventory_table_configuration`, `update_bucket_metadata_journal_table_configuration`, `delete_bucket_metadata_configuration`, `upload_file`, `download_file`, `get_object` |\n\n> Additional AWS services will be supported in future releases.\n\n## Installation\n\n### From PyPI\n\n```bash\npip install pyawsmock\n```\n\n### From GitHub\n\n```bash\npip install git+https://github.com/coldsofttech/pyawsmock.git\n```\n\n#### Dependencies\n\n- `boto3~=1.40.55`\n- `filelock~=3.20.0`\n- `crcmod~=1.7`\n\n> `boto3` is required to delegate calls to real AWS.\n\n## Usage Example\n\n```python\nfrom pyawsmock import configure_mock, client, cleanup_mock\n\nconfigure_mock(mode=\"persistent\", path=\"./local_aws\") # Persistent storage example\nconfigure_mock(mode=\"temporary\") # Temporary storage example\n\nssm = client(\"ssm\", region_name=\"local-eu-west-1\") # eu-west-1 region local mock for SSM\nssm.put_parameter(\n Name=\"/test/key\",\n Value=\"test_value\",\n Type=\"String\"\n)\n\nresponse = ssm.get_parameter(Name=\"/test/key\")\nprint(response[\"Parameter\"][\"Value\"]) # Output: test_value\n\ncleanup_mock() # Only applicable for 'temporary' mode\n```\n\n## Future Plans\n\n- Extend to additional AWS services such as:\n - DynamoDB, S3, Lambda, CloudWatch, etc.\n- Improved IAM user/role matching and permission enforcement.\n- Enhanced logging, auditing, and multi-account support.\n- Full AWS API coverage for supported services.\n- Support for Config, CloudTrail, and authentication workflows.\n- Multi-part S3 upload/download and versioning support.\n\n## License\n\n[MIT License](LICENSE)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Local AWS Mock for Python \u2013 Mock SSM Parameter Store, S3, and extendable AWS services",
"version": "0.1.1",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "510cc17c25711622131c84b2d74df46747a450e3cb1a647a3287c1604dfb4b04",
"md5": "6666aeaacc71c29642318ed6aa39eb1b",
"sha256": "676d072caf075f63c3a71dc91a36189acc96890a0958a94b8af61768cb1f16b0"
},
"downloads": -1,
"filename": "pyawsmock-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6666aeaacc71c29642318ed6aa39eb1b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 5761,
"upload_time": "2025-10-21T12:31:21",
"upload_time_iso_8601": "2025-10-21T12:31:21.906597Z",
"url": "https://files.pythonhosted.org/packages/51/0c/c17c25711622131c84b2d74df46747a450e3cb1a647a3287c1604dfb4b04/pyawsmock-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "0f646e3ca8391b56d6995c363d3fd7bef425de73d1334fe14187a40651e6e704",
"md5": "ba67d184dbe2c7846f3735694c20542f",
"sha256": "52972a0b48a3da8fe8ca4638f8c1a09c0d8c080af9825d848d7d6908e880b22f"
},
"downloads": -1,
"filename": "pyawsmock-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "ba67d184dbe2c7846f3735694c20542f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 5265,
"upload_time": "2025-10-21T12:31:25",
"upload_time_iso_8601": "2025-10-21T12:31:25.117955Z",
"url": "https://files.pythonhosted.org/packages/0f/64/6e3ca8391b56d6995c363d3fd7bef425de73d1334fe14187a40651e6e704/pyawsmock-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-21 12:31:25",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "pyawsmock"
}