opensite-ai/opensite-skills / aws-sdk-python-usage
aws-sdk-python-usage
UnverifiedAWS 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.
| File | Kind | Size |
|---|---|---|
| .aws-skill-metadata | other | 18 B |
| SKILL.md | skill md | 8.0 KB |
| references/configuration.md | markdown | 3.7 KB |
| references/credentials.md | markdown | 3.7 KB |
| references/dynamodb.md | markdown | 8.4 KB |
| references/error-handling.md | markdown | 4.5 KB |
| references/pagination.md | markdown | 3.0 KB |
| references/s3.md | markdown | 5.1 KB |
| references/waiters.md | markdown | 3.3 KB |
references/pagination.md
View on GitHub# Pagination Reference
## Paginators
Most `list_*`, `describe_*`, and `get_*` operations that return collections support pagination. When you only need specific fields, use `.search()` to extract and flatten across pages:
```python
client = boto3.client("ec2")
paginator = client.get_paginator("describe_instances")
for instance_id in paginator.paginate().search("Reservations[].Instances[].InstanceId"):
print(instance_id)
```
When you need the full response object per item, or need per-page control (e.g. counting pages, batching by page), iterate pages directly:
```python
for page in paginator.paginate():
for reservation in page.get("Reservations", []):
for instance in reservation.get("Instances", []):
process(instance)
```
Check if an operation supports pagination:
```python
client.can_paginate("describe_instances") # True
```
## Pagination Configuration
Control page size and total items via `PaginationConfig`:
```python
paginator = client.get_paginator("list_objects_v2")
pages = paginator.paginate(
Bucket="my-bucket",
PaginationConfig={
"PageSize": 100, # items per API call
"MaxItems": 500, # total items across all pages
"StartingToken": None, # resume from a previous NextToken
},
)
```
- `PageSize` controls the `MaxKeys`/`MaxResults`/`Limit` parameter sent to the API
- `MaxItems` stops iteration after this many total items and provides a `NextToken` for resuming
- The paginator uses the correct token parameter name for each service automatically
## JMESPath Filtering
Use `.search()` to extract and flatten results across pages:
```python
paginator = client.get_paginator("list_objects_v2")
page_iterator = paginator.paginate(Bucket="my-bucket")
# Flatten all keys across all pages
keys = page_iterator.search("Contents[].Key")
for key in keys:
print(key)
# Filter with JMESPath expressions
large_objects = page_iterator.search(
"Contents[?Size > `1048576`].{Key: Key, Size: Size}"
)
```
`.search()` returns a generator that yields individual items, not pages -- no need to handle page boundaries.
## Common Paginated Operations
| Service | Operation | Result key |
|---|---|---|
| S3 | `list_objects_v2` | `Contents` |
| DynamoDB | `scan` | `Items` |
| DynamoDB | `query` | `Items` |
| EC2 | `describe_instances` | `Reservations` |
| IAM | `list_users` | `Users` |
| Lambda | `list_functions` | `Functions` |
| CloudWatch Logs | `describe_log_groups` | `logGroups` |
Note: `list_buckets` is not paginated -- it returns all buckets in a single response.
## Resource-Level Pagination
Resources handle pagination automatically via collection methods:
```python
s3 = boto3.resource("s3")
bucket = s3.Bucket("my-bucket")
# .all() paginates automatically
for obj in bucket.objects.all():
print(obj.key)
# .filter() also paginates
for obj in bucket.objects.filter(Prefix="logs/"):
print(obj.key)
# .limit() limits total results
for obj in bucket.objects.limit(100):
print(obj.key)
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |