explaingit

getmoto/moto

8,480PythonAudience · developerComplexity · 2/5Setup · easy

TLDR

Moto is a Python library that intercepts AWS API calls during tests and handles them in memory, so you can test code that uses AWS without connecting to real cloud services.

Mindmap

mindmap
  root((repo))
    What it does
      Mock AWS API calls
      Run tests offline
      Simulate AWS services
    Services Covered
      S3 storage
      EC2 instances
      Many more
    Tech Stack
      Python
      boto3
      pip
    Audience
      Python developers
      AWS developers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Test code that creates S3 buckets and uploads files without connecting to real AWS

USE CASE 2

Run unit tests for Lambda or DynamoDB logic in memory without cloud costs

USE CASE 3

Simulate AWS service behavior in CI pipelines to validate infrastructure scripts

Tech stack

Pythonboto3pip

Getting it running

Difficulty · easy Time to first run · 30min

Install only the services you need, e.g. moto[s3] for S3 or moto[all] for everything.

In plain English

Moto is a Python library that lets you test code that uses Amazon Web Services without actually connecting to AWS. When you run tests, Moto intercepts the calls your code makes to AWS services and handles them in memory instead, simulating the behavior of real AWS without any cost, network dependency, or risk of accidentally modifying real infrastructure. The way it works is straightforward. You wrap a test function with a decorator from Moto, and from that point on, any AWS calls inside that function hit a fake in-memory version of the service instead of the real one. The fake service keeps track of state as the test runs, so if your code creates an S3 bucket and then uploads a file to it, Moto remembers both the bucket and the file, and a subsequent read will return the right data. Moto supports a wide range of AWS services. The ones most commonly used include S3 (object storage), EC2 (virtual machines), and many others. A full list of covered services and features is maintained in the repository's implementation coverage file. Installation is through pip, Python's package manager. You install only the services you need, for example moto[s3] for S3 or moto[all] for everything. The library is used alongside boto3, which is the standard AWS SDK for Python. It is released under an open-source license and supported financially through OpenCollective sponsorship.

Copy-paste prompts

Prompt 1
Show me how to use Moto to test a Python function that uploads a file to S3 using boto3
Prompt 2
Help me write a pytest test that uses Moto to simulate an SQS queue receiving messages
Prompt 3
Set up Moto in my CI pipeline to mock all AWS calls for an app that uses EC2 and DynamoDB
Open on GitHub → Explain another repo

← getmoto on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.