soto-project /soto
Swift SDK for AWS that works on Linux, macOS and iOS
★ 998⑂ 99👁 14⑃ 523● 261▤ 120
+0
日增长
-1
周增长
998
stars
99
forks
14
watchers
523
prs
261
issues
120
releases
README
Soto for AWS
Soto is a Swift language SDK for Amazon Web Services (AWS), working on Linux, macOS and iOS. This library provides access to all AWS services. The service APIs it provides are a direct mapping of the REST APIs Amazon publishes for each of its services. Soto is a community supported project and is in no way affiliated with AWS.
Table of Contents
-----------------
- Structure
- Swift Package Manager
- Configuring Credentials
- Using Soto
- Documentation
- API Reference
- User guides
- Contributing
- License
Structure
The library consists of three parts
1. soto-core which does all the core request encoding and signing, response decoding and error handling.
2. The service api files which define the individual AWS services and their commands with their input and output structures.
3. The CodeGenerator which builds the service api files from the JSON model files supplied by Amazon.
Swift Package Manager
Soto uses the Swift Package Manager to manage its code dependencies. To use Soto in your codebase it is recommended you do the same. Add a dependency to the package in your own Package.swift dependencies.
swift
dependencies: [
.package(url: "https://github.com/soto-project/soto.git", from: "7.0.0")
],
Then add target dependencies for each of the Soto targets you want to use.
swift
targets: [
.target(name: "MyApp", dependencies: [
.product(name: "SotoS3", package: "soto"),
.product(name: "SotoSES", package: "soto"),
.product(name: "SotoIAM", package: "soto")
]),
]
)
Alternatively if you are using Xcode 11 or later you can use the Swift Package Manager integration and add a dependency to Soto through that.
Configuring Credentials
Before using the SDK, you will need AWS credentials to sign all your requests. Credentials can be provided to the library in the following ways.
- Environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
- ECS container IAM policy
- EC2 IAM instance profile
- Shared credentials file in your home directory
- Static credentials provided at runtime
You can find out more about credential providers here
Using Soto
To use Soto you need to create an AWSClient and a service object for the AWS service you want to work with. The AWSClient provides all the communication with AWS and the service object provides the configuration and APIs for communicating with a specific AWS service. More can be found out about AWSClient here and the AWS service objects here.
swift
import SotoS3 //ensure this module is specified as a dependency in your package.swift
let bucket = "my-bucket"
let client = AWSClient(
credentialProvider: .static(accessKeyId: "Your-Access-Key", secretAccessKey: "Your-Secret-Key"),
httpClientProvider: .createNew
)
let s3 = S3(client: client, region: .uswest2)
func createBucketPutGetObject() async throws - S3.GetObjectOutput {
// Create Bucket, Put an Object, Get the Object
_ = try awaiTop issues
#752soto repository history is very large - 381 MiB14 comments · 2025-01-09#627Add MachineLearning middleware for custom Predict endpoint0 comments · 2022-10-26
Discussions
#737Route53 and the IDs returned2 comments · 2024-10-16#728Despite calling shutdown, getting "Fatal error: Client not shut down before the deinit"1 comments · 2024-08-14#727Getting "not implemented" errors on calls that work with s3cmd2 comments · 2024-08-12#725Any examples of calling a Lambda function?5 comments · 2024-07-28#719What is HTTPClientError.deadlineExceeded when uploading?1 comments · 2024-06-01#718Is there a way to get a progress callback?2 comments · 2024-06-01#709try to use SES in Soto SDK with Vapor 4 but I have some error2 comments · 2024-02-05#681How to access S3 with a temporary credential1 comments · 2023-06-27
Latest release
v7.17.0 7.17.0 2026-10-01Using Soto-core v7.17.0 SDK files generated by soto-codegenerator v7.10.0 Minor release changes - Add RetryPolicy to credential providers that perform AWS operations