# AWS Sdk Swift Usage

AWS SDK for Swift development patterns.

- Repository: https://github.com/aws/agent-toolkit-for-aws (3366 stars)
- Category: DevOps
- License: Apache-2.0
- Last updated: 2026-10-30
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add aws/agent-toolkit-for-aws --skill aws-sdk-swift-usage -g -a claude-code -y`
Codex: `npx skills add aws/agent-toolkit-for-aws --skill aws-sdk-swift-usage -g -a codex -y`
Cursor: `npx skills add aws/agent-toolkit-for-aws --skill aws-sdk-swift-usage -g -a cursor -y`
Gemini CLI: `npx skills add aws/agent-toolkit-for-aws --skill aws-sdk-swift-usage -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add aws/agent-toolkit-for-aws`

## Description

AWS SDK for Swift development patterns. Use when writing Swift code that uses AWS services via aws-sdk-swift package.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# AWS SDK for Swift

## Async Code Structure

All SDK operations are async. Use `@main` entry point:

```swift
@main
struct Main {
    static func main() async throws {
        let client = try await S3Client()
        // ... async operations
    }
}
```

## CRITICAL: Use Struct Config Types

NEVER use `S3ClientConfiguration` or `DynamoDBClientConfiguration` - these are DEPRECATED classes.

ALWAYS use the struct-based config types:

- `S3Client.S3ClientConfig` (not S3ClientConfiguration)
- `DynamoDBClient.DynamoDBClientConfig` (not DynamoDBClientConfiguration)  
- `STSClient.STSClientConfig` (not STSClientConfiguration)

Config parameters MUST be in declaration order. Region is ALWAYS required when creating a config. Check the service client source for exact order.

```swift
// CORRECT - struct config
let config = try await S3Client.S3ClientConfig(region: "us-west-2")
let client = S3Client(config: config)

// WRONG - deprecated class
// let config = try await S3Client.S3ClientConfiguration(region: "us-west-2")
```

## Client Creation

All service clients follow the same pattern: `<Service>Client` with `<Service>Client.<Service>ClientConfig`.

Model types (structs/enums used in requests/responses) are namespaced under `<Service>ClientTypes`:

- `S3ClientTypes.Bucket`, `S3ClientTypes.Object`
- `DynamoDBClientTypes.AttributeValue`
- `CloudWatchClientTypes.MetricDatum`, `CloudWatchClientTypes.Dimension`

```swift
import AWSS3
import AWSDynamoDB

// Simple - auto-detects region
let s3 = try await S3Client()
let dynamo = try await DynamoDBClient()

// With region
let s3 = try S3Client(region: "us-west-2")

// With config - parameters must be in declaration order
let config = try await S3Client.S3ClientConfig(
    useFIPS: true,
    awsRetryMode: .adaptive,
    maxAttempts: 5,
    region: "us-west-2"
)
let client = S3Client(config: config)

The rest: https://github.com/aws/agent-toolkit-for-aws/blob/HEAD/plugins/aws-core/skills/aws-sdk-swift-usage/SKILL.md
