All skills
aws avatar

/aws-sdk-python-usage

@c3ed514

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.

Use this Skill: https://skilld.dev/gh/aws/agent-toolkit-for-aws/aws-sdk-python-usage

This session only. Nothing lands on disk.

referencesconfiguration.md

≈959 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Client Configuration Reference

botocore.config.Config

All configuration is passed via botocore.config.Config. Multiple configs can be merged:

from botocore.config import Config

base = Config(retries={"total_max_attempts": 2, "mode": "standard"})
s3_specific = Config(s3={"addressing_style": "path"})

# Merge -- later config wins on conflicts
client = boto3.client("s3", config=base.merge(s3_specific))

Retry Configuration

config = Config(
    retries={
        "total_max_attempts": 2,    # total attempts including first try (1 retry attempt here)
        "mode": "adaptive",         # legacy | standard | adaptive
    }
)

Prefer using total_max_attempts over the legacy max_attempts. The max_attempts value does not include the first attempt (it's actually the number of retry attempts).

Mode Default attempts Behavior
legacy 5 Retries on a limited set of errors
standard 3 Broader retryable errors, consistent exponential backoff
adaptive 3 Standard + client-side rate limiting (token bucket)

Can also set via AWS_MAX_ATTEMPTS and AWS_RETRY_MODE env vars or ~/.aws/config.

Timeouts

config = Config(
    connect_timeout=5,    # seconds to establish connection (default 60)
    read_timeout=10,      # seconds to wait for response data (default 60)
)

Connection Pool

config = Config(
    max_pool_connections=50,  # default 10 per client
)

Each client maintains its own urllib3 connection pool. If you're making parallel requests (e.g. with concurrent.futures), set max_pool_connections to match your concurrency level to avoid connection churn.

Custom Endpoints

# Custom S3 endpoint on localhost.
client = boto3.client(
    "s3",
    endpoint_url="http://localhost:4566",
    region_name="us-east-1",
)

# FIPS endpoints
config = Config(use_fips_endpoint=True)
client = boto3.client("s3", config=config)

# Dual-stack (IPv4 + IPv6)
config = Config(use_dualstack_endpoint=True)
client = boto3.client("s3", config=config)

Proxy Configuration

# Via environment variables (preferred)
# HTTP_PROXY=http://proxy:8080
# HTTPS_PROXY=http://proxy:8080

# Via Config
config = Config(
    proxies={"https": "http://proxy:8080"},
    proxies_config={"proxy_ca_bundle": "/path/to/ca-bundle.crt"},
)

S3-Specific Configuration

config = Config(
    s3={
        "addressing_style": "path",       # path | virtual | auto (default)
        "payload_signing_enabled": False,  # skip payload signing for large uploads
        "us_east_1_regional_endpoint": "regional",
    },
    signature_version="s3v4",
)

# Transfer acceleration
config = Config(s3={"use_accelerate_endpoint": True})

User-Agent Customization

config = Config(
    user_agent_appid="my-app/1.0",
    user_agent_extra="custom-metadata",
)

Sharing Config Across Clients

from botocore.config import Config

config = Config(
    retries={"total_max_attempts": 2, "mode": "standard"},
    connect_timeout=5,
    read_timeout=10,
)

# Same config for multiple clients
s3 = boto3.client("s3", config=config)
dynamodb = boto3.client("dynamodb", config=config)
lambda_client = boto3.client("lambda", config=config)

You can also set a default client config in a botocore Session:

from botocore.config import Config
from botocore.session import Session

config = Config(
    retries={"total_max_attempts": 2, "mode": "standard"},
    connect_timeout=5,
    read_timeout=10,
)
session = Session()
session.set_default_client_config(config)
# Now all clients created will use this session-specific default
# config if an explicit config is not provided.
s3 = session.create_client('s3')
dynamodb = session.create_client('dynamodb')

Source: SKILL.md on GitHub

No alerts16d3 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    This skill provides comprehensive guidance and best practices for using the AWS SDK for Python (boto3/botocore). It covers essential topics such as session management, credential resolution, error handling, and service-specific patterns for S3 and DynamoDB. The skill aligns with security best practices, particularly regarding credential management and robust application configuration.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

Signed by skilld at c3ed514. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 5 months ago

README badge

README badge for aws/agent-toolkit-for-aws/aws-sdk-python-usage