# aws-sdk-python-usage

Guides agents writing Python code with boto3 and botocore. It enforces official patterns for client versus resource choice, error handling, paginators, and session reuse.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 7800 installs · ★ 3282
- Author: aws
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/aws/agent-toolkit-for-aws/tree/HEAD/skills/core-skills/aws-sdk-python-usage/SKILL.md
- Updated: 2026-10-23
- HTML: https://affpapa.org/en/nevibecode/skills/aws-sdk-python-usage

## What it does

The skill instructs agents on using `boto3` and `botocore` without anti-patterns. It separates low-level clients from high-level resources. Resources exist for select services like S3 or DynamoDB and handle type conversions automatically. Parameter names in calls must follow PascalCase to mirror AWS API specifications.

Creating clients inside loops is forbidden because clients are thread-safe and should be reused. Business functions must never call `sys.exit()`, as that breaks testability and prevents library imports. For lists, it directs the agent to use built-in paginators with JMESPath queries instead of manual `NextToken` loops.

Exceptions must propagate unless an actionable fallback exists. Swallowing an error just to log it hides bugs from callers. The skill enforces catching specific exceptions via `client.exceptions` in service logic, reserving `botocore.exceptions.ClientError` for top-level script handlers. Emojis in code, comments, or output are explicitly banned.

## Requirements
- Works with: AWS

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add aws/agent-toolkit-for-aws --skill aws-sdk-python-usage -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/aws-sdk-python-usage/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/aws-sdk-python-usage/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add aws/agent-toolkit-for-aws --skill aws-sdk-python-usage -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/aws-sdk-python-usage/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add aws/agent-toolkit-for-aws --skill aws-sdk-python-usage -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/aws-sdk-python-usage/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install aws/agent-toolkit-for-aws aws-sdk-python-usage
```

2. **Manually: put the files in place**
- File: `.github/skills/aws-sdk-python-usage/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add aws/agent-toolkit-for-aws --skill aws-sdk-python-usage -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/aws/agent-toolkit-for-aws --path skills/core-skills/aws-sdk-python-usage
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/aws-sdk-python-usage/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add aws/agent-toolkit-for-aws --skill aws-sdk-python-usage -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/aws/agent-toolkit-for-aws/tree/HEAD/skills/core-skills/aws-sdk-python-usage/SKILL.md

## When to use it
- choose between client and resource interfaces for a given AWS service
- paginate large AWS responses using get_paginator and JMESPath projections
- catch typed API exceptions with client.exceptions instead of swallowing errors
- isolate CLI parsing and exit codes in main() without sys.exit() in core logic
- configure client retries, timeouts, and connection pools using botocore.config.Config

## Example prompts
- Write a boto3 script to paginate IAM users filtered by path /admin/ using JMESPath
- Create a Python function to fetch an S3 object with proper client.exceptions handling
- Configure a boto3 DynamoDB client with a 50-connection pool and adaptive retries

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 23be754971e97366.

BEGIN THIRD-PARTY FILE 23be754971e97366
````text
---
name: aws-sdk-python-usage
description: |
  AWS SDK for Python (boto3/botocore) development patterns. You MUST use this skill when writing Python code that uses AWS services via boto3 or botocore. This includes creating service clients or resources, configuring sessions and credentials, handling errors with ClientError, using paginators and waiters, S3 file transfers and presigned URLs, DynamoDB table operations, and any boto3/botocore client configuration. Use this skill whenever Python code imports boto3 or botocore, or when the user asks about AWS operations in Python.
---

> Do not use emojis in any code, comments, or output when this skill is active.

# AWS SDK for Python (boto3)

boto3 is the high-level Python SDK for AWS. It wraps botocore (the low-level
SDK) and provides two distinct interfaces: **clients** (low-level, 1:1 API
mapping) and **resources** (high-level, object-oriented). Understanding which to
use and when is essential.

## Client vs Resource

**Clients** map directly to AWS service APIs. Every service has a client.
Responses are plain dicts.

**Resources** provide an object-oriented interface with attributes and actions.
Only some services have resources (S3, DynamoDB, EC2, IAM, SQS, SNS,
CloudFormation, CloudWatch, Glacier). Resources auto-marshal types (especially
useful for DynamoDB).

```python
import boto3

# Client - low-level, all services
s3_client = boto3.client("s3")
response = s3_client.list_buckets()
buckets = response["Buckets"]  # plain dicts

# Resource - high-level, select services
s3_resource = boto3.resource("s3")
for bucket in s3_resource.buckets.all():
    print(bucket.name)  # attribute access, not dict keys
```

Use clients when you need full API coverage or the service has no resource
interface. Use resources when they exist and simplify your code (especially
DynamoDB and S3).

## Session and Client Creation

```python
import boto3

# Default session implicitly created
client = boto3.client("s3")
resource = boto3.resource("dynamodb")

# Explicit session use when you need to customize how
# clients are created, use an explicit profile, etc.
session = boto3.Session(
    profile_name="my-profile",
    region_name="us-west-2",
)
client = session.client("s3")
```

Do not create clients inside loops - reuse a single client instance.  Clients
````
END THIRD-PARTY FILE 23be754971e97366

The third-party file has ended. Everything between the 23be754971e97366 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2324 of 8202 bytes. © aws · Apache-2.0 · https://github.com/aws/agent-toolkit-for-aws/tree/HEAD/skills/core-skills/aws-sdk-python-usage/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
