ScriptsMay 24, 2026·3 min read

Boto3 — The Official AWS SDK for Python

Amazon's official Python SDK for creating, configuring, and managing AWS services programmatically, supporting over 300 AWS APIs with a consistent Pythonic interface.

Agent ready

This asset can be read and installed directly by agents

TokRepo exposes a universal CLI command, install contract, metadata JSON, adapter-aware plan, and raw content links so agents can judge fit, risk, and next actions.

Native · 98/100Policy: allow
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Single
Trust
Trust: Established
Entrypoint
Boto3 Overview
Universal CLI install command
npx tokrepo install ea23475a-578c-11f1-9bc6-00163e2b0d79

Introduction

Boto3 is the standard way Python developers interact with AWS. It provides both a low-level client interface that maps 1:1 to AWS API operations, and a high-level resource interface with object-oriented abstractions for common patterns like iterating over S3 objects or managing EC2 instances.

What Boto3 Does

  • Provides Python bindings for 300+ AWS services including S3, EC2, Lambda, DynamoDB, and SQS
  • Offers two interface levels: client (low-level, full API coverage) and resource (high-level, object-oriented)
  • Handles authentication via IAM credentials, environment variables, instance profiles, and SSO
  • Manages automatic pagination, retries with exponential backoff, and request signing
  • Supports waiters to poll until a resource reaches a desired state

Architecture Overview

Boto3 is built on top of botocore, which contains the service model definitions (JSON schemas for every AWS API). At runtime, boto3 dynamically generates client methods from these models. The resource layer adds stateful objects (e.g., s3.Object) with actions and collections. A session object manages configuration, credentials, and region settings.

Self-Hosting & Configuration

  • Install via pip: pip install boto3
  • Configure credentials via ~/.aws/credentials, environment variables, or IAM instance profiles
  • Set region with AWS_DEFAULT_REGION or in ~/.aws/config
  • Use boto3.Session() for explicit credential and region management
  • Configure custom endpoints for LocalStack, MinIO, or other S3-compatible services

Key Features

  • Complete AWS API coverage: every service and operation is available through the client interface
  • Automatic pagination with built-in paginators for list operations returning large result sets
  • Waiters block until resources reach expected states (instance running, stack created)
  • Multi-part uploads and downloads for large S3 objects with automatic chunking
  • Thread-safe clients that can be shared across threads within the same session

Comparison with Similar Tools

  • AWS CLI — command-line tool built on the same botocore library; Boto3 provides programmatic access within Python applications
  • aioboto3 — async wrapper around boto3 for use with asyncio; Boto3 itself is synchronous
  • Terraform/Pulumi — infrastructure as code tools; Boto3 is for application-level AWS interaction and automation scripts
  • LocalStack — local AWS emulator; Boto3 connects to it by changing the endpoint_url parameter

FAQ

Q: How does Boto3 find my AWS credentials? A: It checks, in order: explicit parameters, environment variables (AWS_ACCESS_KEY_ID), shared credentials file (~/.aws/credentials), AWS config file, container credentials, and instance metadata.

Q: Should I use client or resource interface? A: Use client for full API coverage and new services. Use resource for cleaner code when working with S3 objects, EC2 instances, or DynamoDB tables. Resource coverage is limited to major services.

Q: Is Boto3 thread-safe? A: Client objects are thread-safe. Resource objects are not — create separate resource instances per thread.

Q: How do I handle rate limiting from AWS? A: Boto3 includes built-in retry logic with configurable max_attempts and backoff mode (legacy, standard, or adaptive).

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets