aws-sdk-swift-usage

Write Swift code using AWS SDK clients, configs, credentials, waiters, and pagination.

1|Updated Aug 1, 2024
One-click install
npx skills add https://github.com/obispobruno/dotfiles --skill aws-sdk-swift-usage-obispobruno
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: aws-sdk-swift-usage
Source: https://github.com/obispobruno/dotfiles/tree/main/dot_agents/skills/aws-sdk-swift-usage
Command: npx skills add https://github.com/obispobruno/dotfiles --skill aws-sdk-swift-usage-obispobruno

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers writing Swift applications against AWS services often misuse deprecated configuration classes, misorder config parameters, or struggle with async client setup, credential resolvers, and pagination in the aws-sdk-swift package. ## Core Features & Use Cases - Correct Client Configuration: Enforces struct-based config types like S3Client.S3ClientConfig instead of deprecated S3ClientConfiguration classes, with parameters in declaration order. - Credential & Auth Patterns: Provides static credentials, default resolver chains, and STS assume-role resolver setup for authenticated requests. - Async Operations Coverage: Covers waiters, paginated list operations, presigned URLs, and common S3 operations like putObject and getObject. - Use Case: You are building a Swift command-line tool that uploads files to S3 and lists DynamoDB records; this Skill ensures every client is created with the correct config struct, region, and retry settings. ## Quick Start Write Swift code using the AWS SDK for Swift to create an S3 client in us-west-2 and upload a file to a bucket.

Frequently Asked Questions about aws-sdk-swift-usage

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create an S3 client in Swift with aws-sdk-swift?▼

Create an S3 client by calling try await S3Client() for auto-detected region, or build an S3Client.S3ClientConfig with a region and pass it to S3Client(config:). All operations are async, so use an async entry point like @main with static func main() async throws.

How to configure AWS credentials in Swift SDK?▼

Use StaticAWSCredentialIdentityResolver with an AWSCredentialIdentity for fixed keys, or DefaultAWSCredentialIdentityResolverChain for environment-based credentials. For assumed roles, wrap an underlying resolver in STSAssumeRoleAWSCredentialIdentityResolver with a role ARN and session name.

Why is S3ClientConfiguration deprecated in aws-sdk-swift?▼

S3ClientConfiguration and similar classes are deprecated in favor of struct-based config types like S3Client.S3ClientConfig. The struct configs require parameters in declaration order and region is always required when creating a config.

Does aws-sdk-swift support pagination for list operations?▼

Yes, paginated operations are available as async sequences, such as client.listObjectsV2Paginated(input:). Iterate with for try await page to process each page of results and access items like page.contents.

How do I generate a presigned URL for S3 in Swift?▼

Call client.presignedURLForGetObject with a GetObjectInput specifying bucket and key, plus an expiration in seconds. The method returns a presigned URL that grants temporary access to the object.

Can I use a custom endpoint or HTTP client with aws-sdk-swift?▼

Yes, pass an endpoint parameter in the config struct for custom endpoints, or provide an httpClientEngine such as URLSessionHTTPClient configured with HttpClientConfiguration from ClientRuntime.