
Aws Sdk Swift Usage
Write correct async Swift client code against AWS services using current struct-based SDK configs.
Overview
Aws-sdk-swift-usage is an agent skill for the Build phase that applies correct AWS SDK for Swift async and struct-config patterns.
Install
npx skills add https://github.com/aws/agent-toolkit-for-aws --skill aws-sdk-swift-usageWhat is this skill?
- Async @main entry pattern for all SDK operations
- Mandatory struct configs: S3Client.S3ClientConfig—not deprecated S3ClientConfiguration classes
- Region required on config; parameters must follow declaration order from service client source
- Namespaced types via S3ClientTypes, DynamoDBClientTypes for requests and responses
- Consistent client creation pattern across S3, DynamoDB, STS, and other services
Adoption & trust: 912 installs on skills.sh; 819 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your agent keeps emitting deprecated S3ClientConfiguration-style APIs or mis-ordered config that fails to compile against aws-sdk-swift.
Who is it for?
Indie devs building Swift apps or CLIs that call S3, DynamoDB, or other AWS APIs via aws-sdk-swift.
Skip if: Python/TypeScript AWS work, Terraform-only infra, or greenfield AWS account architecture without Swift code.
When should I use this skill?
Writing Swift code that uses AWS services via the aws-sdk-swift package.
What do I get? / Deliverables
Swift AWS client code compiles with modern struct configs, proper async structure, and correct ClientTypes usage.
- Correct async Swift AWS client snippets
- Struct-based service client initialization
Recommended Skills
Journey fit
How it compares
Swift SDK cheat sheet skill, not the broader AWS deployment or agent-toolkit MCP surface.
Common Questions / FAQ
Who is aws-sdk-swift-usage for?
Solo builders and small teams writing Swift that integrates AWS services through the official aws-sdk-swift package.
When should I use aws-sdk-swift-usage?
During Build integrations whenever you add or refactor S3, DynamoDB, STS, or other AWS calls in Swift.
Is aws-sdk-swift-usage safe to install?
Check the Security Audits panel on this Prism page; the skill is documentation-only patterns with no bundled credential handling.
SKILL.md
READMESKILL.md - Aws Sdk Swift Usage
# 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) // With custom endpoint and credentials let config = try await S3Client.S3ClientConfig( awsCredentialIdentityResolver: resolver, region: "us-west-2", endpoint: "https://s3.custom-endpoint.com" ) ``` Common config parameters (MUST follow declaration order): - `awsCredentialIdentityResolver` - Custom credentials - `useFIPS` - Enable FIPS endpoints - `useDualStack` - Enable dual-stack endpoints - `awsRetryMode` - Retry strategy (.adaptive, .standard, .legacy) - `maxAttempts` - Max retry attempts - `region` - AWS region - `httpClientEngine` - Custom HTTP client (requires HttpClientConfiguration parameter): ```swift import ClientRuntime let httpConfig = HttpClientConfiguration() let httpClient = URLSessionHTTPClient(httpClientConfiguration: httpConfig) let config = try await S3Client.S3ClientConfig( region: "us-east-1", httpClientEngine: httpClient ) ``` - `endpoint` - Custom endpoint URL For service-specific config options or exact parameter order, check `Sources/Services/AWS<Service>/Sources/AWS<Service>/<Service>Client.swift` in the SDK. ## Credential Resolvers ```swift import AWSSDKIdentity import SmithyIdentity // Static credentials - pass credential object directly let creds = AWSCredentialIdentity(accessKey: "AKIA...", secret: "...") let resolver = StaticAWSCredentialIdentityResolver(creds) // Assume role - REQUIRES underlying resolver let underlying = try DefaultAWSCredentialIdentityResolverChain() let resolver = try STSAssumeRoleAWSCredentialIdentityResolver( awsCredentialIdentityResolver: underlying, roleArn: "arn:aws:iam::123456789012:role/MyRole", sessionName: "session-name" ) // Use in config let config = try await S3Client.S3ClientConfig( awsCredentialIdentityResolver: resolver, region: "us-west-2" ) ``` ## Waiters Import `SmithyWaitersAPI`. WaiterOptions requires `maxWaitTime` parameter: ```swift import AWSS3 import SmithyWaitersAPI let client = try