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/waiters.md
View on GitHub# Waiters Reference
## Using Waiters
Waiters poll an AWS operation until a resource reaches a desired state or the waiter times out:
```python
import boto3
ec2 = boto3.client("ec2")
# Start an instance
ec2.start_instances(InstanceIds=["i-1234567890abcdef0"])
# Wait until it's running
waiter = ec2.get_waiter("instance_running")
waiter.wait(
InstanceIds=["i-1234567890abcdef0"],
WaiterConfig={
"Delay": 15, # seconds between polls (default varies by waiter)
"MaxAttempts": 40, # max poll attempts (default varies by waiter)
},
)
```
## WaiterConfig
| Parameter | Description |
|---|---|
| `Delay` | Seconds between polling attempts |
| `MaxAttempts` | Maximum number of polling attempts before raising `WaiterError` |
Both are optional and override the waiter's built-in defaults.
## Common Waiters
| Service | Waiter | Polls until |
|---|---|---|
| S3 | `bucket_exists` | HeadBucket succeeds |
| S3 | `bucket_not_exists` | HeadBucket returns 404 |
| S3 | `object_exists` | HeadObject succeeds |
| S3 | `object_not_exists` | HeadObject returns 404 |
| EC2 | `instance_running` | Instance state is "running" |
| EC2 | `instance_stopped` | Instance state is "stopped" |
| EC2 | `instance_terminated` | Instance state is "terminated" |
| RDS | `db_instance_available` | DB instance is "available" |
| CloudFormation | `stack_create_complete` | Stack status is CREATE_COMPLETE |
| CloudFormation | `stack_delete_complete` | Stack no longer exists |
List available waiters for a client:
```python
client.waiter_names # ["bucket_exists", "bucket_not_exists", ...]
```
## Waiter Errors
```python
from botocore.exceptions import WaiterError
try:
waiter = s3.get_waiter("object_exists")
waiter.wait(Bucket="bucket", Key="key")
except WaiterError as e:
print(f"Waiter failed: {e}")
# e.last_response contains the last polling response
```
A `WaiterError` is raised when:
- `MaxAttempts` is exceeded without reaching the desired state
- The waiter enters a terminal failure state (e.g., the resource entered an unrecoverable state)
## Custom Waiters
For operations without built-in waiters, define a custom waiter model:
```python
import boto3
from botocore.waiter import WaiterModel, create_waiter_with_client
waiter_config = {
"version": 2,
"waiters": {
"FunctionActive": {
"operation": "GetFunction",
"delay": 5,
"maxAttempts": 20,
"acceptors": [
{
"matcher": "path",
"expected": "Active",
"argument": "Configuration.State",
"state": "success",
},
{
"matcher": "path",
"expected": "Failed",
"argument": "Configuration.State",
"state": "failure",
},
],
}
},
}
client = boto3.client("lambda")
waiter_model = WaiterModel(waiter_config)
waiter = create_waiter_with_client("FunctionActive", waiter_model, client)
waiter.wait(FunctionName="my-function")
```
### Acceptor matchers
| Matcher | Description |
|---|---|
| `path` | JMESPath expression against the response |
| `pathAll` | All items in a JMESPath list must match |
| `pathAny` | Any item in a JMESPath list must match |
| `status` | HTTP status code |
| `error` | Error code string |
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 |