Skip to main content

Local AWS Mock for Python – Mock SSM Parameter Store, S3, SQS, CodeArtifact, CloudFront, and extendable AWS services

Project description

🧩 pyawsmock - Local AWS Mock Framework

🧠 A lightweight, extensible Python package that mocks AWS services locally for development and testing - with real AWS delegation when needed.


🚀 Overview

pyawsmock emulates popular AWS services locally, allowing developers to test AWS-dependent applications without needing cloud connectivity. It's boto3-compatible, automatically delegating API calls to the real AWS SDK when using non-local regions.

✅ Currently Supported Services

Service Description
🪣 S3 Object storage mock supporting uploads, downloads, metadata, and checksums.
⚙️ SSM Parameter Store Local emulation of AWS SSM Parameters with versioning, labels, and encryption.
🧱 CodeArtifact Domain & repository management with package versioning and mock endpoints.
🌐 CloudFront Create and manage distributions and origin access identities locally.
📬 SQS Local emulation of SQS with FIFO support.

🧠 Key Features

🧭 Local vs AWS Delegation

  • Regions starting with local-* automatically use local mock services.
  • Other regions transparently delegate calls to real AWS using boto3.

💾 Persistent & Temporary Storage

  • Persistent mode — data is stored on disk (for long-term local environments).
  • Temporary mode — uses an in-memory or temp directory; cleanup() removes it automatically.

🕓 Audit & Metadata

  • Tracks all operations with timestamps.
  • Simulates IAM users (mock-user) and arn:mock identifiers.
  • Default mock AWS Account ID: 000000000000.

🔐 SecureString & Encryption Simulation

  • For SSM, SecureString values are stored base64-encoded.
  • Retrieval with WithDecryption=True automatically decodes them.

🪶 Lightweight & Extensible

  • Minimal dependencies (boto3, filelock, crcmod).
  • Modular mock architecture — easy to extend to new AWS services.

⚙️ Installation

📦 From PyPI

pip install pyawsmock

🧩 From GitHub

pip install git+https://github.com/coldsofttech/pyawsmock.git

Dependencies

  • boto3~=1.40.55
  • filelock~=3.20.0
  • crcmod~=1.7

boto3 is required for delegation to real AWS services.


🧰 Quick Start Example

from pyawsmock import configure_mock, client, cleanup_mock

# 1️⃣ Configure mock mode
configure_mock(mode="persistent", path="./local_aws")  # Persistent local store
# or
configure_mock(mode="temporary")  # Temporary store

# 2️⃣ Create a local client (SSM)
ssm = client("ssm", region_name="local-eu-west-1")

# 3️⃣ Use it just like boto3
ssm.put_parameter(Name="/demo/key", Value="demo_value", Type="String")

response = ssm.get_parameter(Name="/demo/key")
print(response["Parameter"]["Value"])  # Output: demo_value

# 4️⃣ Cleanup (only for temporary mode)
cleanup_mock()

⚡ All clients (SSM, S3, SQS, CodeArtifact, CloudFront) use the same interface as boto3. Switching between real AWS and local mock only depends on the region.

🧩 Supported Methods

Service Supported API Calls
⚙️ 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, upload_file, download_file, get_object, create_bucket_metadata_configuration, update_bucket_metadata_inventory_table_configuration, delete_bucket_metadata_configuration, etc.
🧱 CodeArtifact create_domain, create_repository, publish_package_version, list_packages, delete_package, get_authorization_token, get_repository_endpoint, etc.
🌐 CloudFront create_distribution, get_distribution, get_distribution_config, update_distribution, delete_distribution, etc.
📬 SQS create_queue, get_queue_url, set_queue_attributes, get_queue_attributes, list_queues, purge_queue, etc.

🧩 More services coming soon: API Gateway, DynamoDB, Lambda, CloudWatch, Config, and **CloudTrail **.

⚠️ Known Limitations

  • IAM, authentication, and permissions are not enforced.
  • S3 multipart uploads and full versioning are not implemented yet.
  • CodeArtifact currently supports only generic asset types and HTTP endpoints.
  • CloudFront distribution behavior is limited to configuration storage only.
  • SQS automatic background timers for DelaySeconds and VisibilityTimeout currently do not exist.

🧭 Roadmap

Status Feature
SSM, S3, SQS, CodeArtifact, CloudFront support
🚧 API Gateway, DynamoDB, Lambda, CloudWatch mocks
🚧 IAM simulation with multiple mock users
🕓 Enhanced audit logging & metrics
🧩 Multi-account & multi-region persistence

🤝 Contributing

Contributions are welcome! To contribute:

  1. Fork the repo
  2. Create a feature branch
  3. Add tests and update docs
  4. Submit a pull request

⚖️ License

MIT 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

pyawsmock-0.1.4.tar.gz (33.1 kB view details)

Uploaded Source

Built Distribution

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

pyawsmock-0.1.4-py3-none-any.whl (37.0 kB view details)

Uploaded Python 3

File details

Details for the file pyawsmock-0.1.4.tar.gz.

File metadata

  • Download URL: pyawsmock-0.1.4.tar.gz
  • Upload date:
  • Size: 33.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for pyawsmock-0.1.4.tar.gz
Algorithm Hash digest
SHA256 35e74945dddaba48af7ccfb1f73d8df6faf35b23a8d048d3d1746fb6acf68a62
MD5 d7b43e08fde7dc7ed65dd97967c5ee50
BLAKE2b-256 2728e8006e7b1b7b3e4781b3939e68f6465f949f821d82bdb77e1eaf6e7cf9aa

See more details on using hashes here.

File details

Details for the file pyawsmock-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: pyawsmock-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 37.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for pyawsmock-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 603fd5fecd8c1ce76ef345871f674e3a0a001c3e127d27543a862fae2bf32da9
MD5 613068e4c8edc80475a84eca5969d2ff
BLAKE2b-256 046d3065db2b1b1f41e03e58255d56d3cdf6cdd5fdcf10ba57efd2bbe86ddbd2

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