skillfed

aws-sdk-python-usage

Learn how to build Python applications with boto3 and botocore, including when to use clients versus resources, session management, error handling with typed exceptions, pagination with JMESPath, waiters, and client configuration. Covers S3, DynamoDB, and other AWS services with practical patterns for production code.

aws-sdk-python-usage teaches boto3 and botocore patterns for writing Python code that interacts with AWS services.

AI-generated summary based on this skill's SKILL.md

2,148 202 Apache-2.0 updated by aws

Install

aws/agent-toolkit-for-aws/aws-sdk-python-usage · repository language: Python

CLI (skillfed)coming soon
git clone https://github.com/aws/agent-toolkit-for-aws
cp -r agent-toolkit-for-aws/skills/core-skills/aws-sdk-python-usage ~/.claude/skills/aws-sdk-python-usage

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How to use boto3 in Python to interact with AWS services?

aws-sdk-python-usage teaches you to write Python code with boto3 and botocore for AWS service interaction. Start by creating a session, then instantiate a client or resource for your target service (S3, DynamoDB, etc.). Clients offer low-level API access with full control; resources provide higher-level, object-oriented interfaces. Use clients for fine-grained operations and resources for simpler, more intuitive workflows. The skill covers practical patterns for both approaches across multiple AWS services.

What's the difference between boto3 client vs resource?

aws-sdk-python-usage explains that boto3 clients and resources serve different purposes. Clients are low-level interfaces that map directly to AWS API operations, giving you complete control and access to all service features. Resources are higher-level, object-oriented abstractions that simplify common tasks with cleaner syntax. Choose clients when you need fine-grained control or access to advanced features; use resources for straightforward operations where readability matters more than flexibility.

How do you handle boto3 ClientError and other exceptions?

aws-sdk-python-usage covers proper error handling in boto3 code using typed exceptions from botocore. Catch ClientError to handle service-specific failures, and inspect the error code and message to determine the root cause. Use try-except blocks around boto3 calls, and leverage error codes to implement retry logic or fallback strategies. The skill teaches production-ready patterns for distinguishing transient errors from permanent failures and responding appropriately.

How to paginate through large AWS API responses with boto3?

aws-sdk-python-usage teaches pagination using boto3's built-in paginators and JMESPath filtering. Create a paginator for your operation (e.g., list_objects for S3), then iterate through pages automatically without manual token management. Paginators handle NextToken logic internally, making it simple to process large result sets efficiently. The skill demonstrates practical pagination patterns for services like S3 and DynamoDB to avoid overwhelming API responses.

How do you configure boto3 client retries and timeouts?

aws-sdk-python-usage covers boto3 client configuration through botocore Config objects. Set retry policies (max_attempts, retry_delay_base), connection timeouts, and read timeouts to match your application's reliability needs. Pass the Config object when creating a client to apply these settings. The skill explains best practices for production code, including exponential backoff strategies and when to adjust defaults for specific workloads.

What are boto3 sessions and how do you manage credentials?

aws-sdk-python-usage explains that boto3 sessions manage credentials, region configuration, and client/resource creation. Sessions automatically detect credentials from environment variables, IAM roles, or credential files. You can explicitly create sessions with specific profiles or credentials for multi-account scenarios. The skill covers session management patterns, credential precedence, and best practices for securing AWS access in Python applications.

SKILL.md

rendered from the published skill — quoted content, verbatim

> 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

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 8 files
skills/core-skills/aws-sdk-python-usage/SKILL.md
skills/core-skills/aws-sdk-python-usage/references/configuration.md
skills/core-skills/aws-sdk-python-usage/references/credentials.md
skills/core-skills/aws-sdk-python-usage/references/dynamodb.md
skills/core-skills/aws-sdk-python-usage/references/error-handling.md
skills/core-skills/aws-sdk-python-usage/references/pagination.md
skills/core-skills/aws-sdk-python-usage/references/s3.md
skills/core-skills/aws-sdk-python-usage/references/waiters.md

Related skills

Tags

low-level-api object-oriented-interface service-clients async-patterns resource-management state-waiting connection-pooling wire-protocol-debugging credential-management batch-operations