All Projects → soto-project → Soto

soto-project / Soto

Licence: apache-2.0
Swift SDK for AWS that works on Linux, macOS and iOS

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Soto

Trackiam
A project to collate IAM actions, AWS APIs and managed policies from various public sources.
Stars: ✭ 115 (-80.14%)
Mutual labels:  aws, aws-sdk
Winston Cloudwatch
Send logs to Amazon Cloudwatch using Winston.
Stars: ✭ 172 (-70.29%)
Mutual labels:  aws, aws-sdk
Hexaville
The modern serverless web application engine and framework for Swift
Stars: ✭ 123 (-78.76%)
Mutual labels:  aws, server-side-swift
Awsconsolerecorder
Records actions made in the AWS Management Console and outputs the equivalent CLI/SDK commands and CloudFormation/Terraform templates.
Stars: ✭ 1,152 (+98.96%)
Mutual labels:  aws, aws-sdk
Aws Sdk Ruby
The official AWS SDK for Ruby.
Stars: ✭ 3,328 (+474.78%)
Mutual labels:  aws, aws-sdk
Awesome Aws
A curated list of awesome Amazon Web Services (AWS) libraries, open source repos, guides, blogs, and other resources. Featuring the Fiery Meter of AWSome.
Stars: ✭ 9,895 (+1608.98%)
Mutual labels:  aws, aws-sdk
Aws Sdk Perl
A community AWS SDK for Perl Programmers
Stars: ✭ 153 (-73.58%)
Mutual labels:  aws, aws-sdk
Aws Sdk Java V2
The official AWS SDK for Java - Version 2
Stars: ✭ 1,083 (+87.05%)
Mutual labels:  aws, aws-sdk
Gatsby Auth Starter Aws Amplify
Starter Project with Authentication with Gatsby & AWS Amplify
Stars: ✭ 306 (-47.15%)
Mutual labels:  aws, aws-sdk
soto-core
Core framework of Soto the Swift SDK for AWS
Stars: ✭ 95 (-83.59%)
Mutual labels:  aws-sdk, server-side-swift
Limes
Limes provides an easy work flow with MFA protected access keys, temporary credentials and access to multiple roles/accounts.
Stars: ✭ 67 (-88.43%)
Mutual labels:  aws, aws-sdk
Aws Amplify Vue
A Vue.js starter app integrated with AWS Amplify
Stars: ✭ 359 (-38%)
Mutual labels:  aws, aws-sdk
Aws
Swift wrapper around AWS API
Stars: ✭ 67 (-88.43%)
Mutual labels:  aws, server-side-swift
Smart Security Camera
A Pi Zero and Motion based webcamera that forwards images to Amazon Web Services for Image Processing
Stars: ✭ 103 (-82.21%)
Mutual labels:  aws, aws-sdk
Aws Pagination Rules
The rules for pagination in AWS SDKs
Stars: ✭ 57 (-90.16%)
Mutual labels:  aws, aws-sdk
Paws
Paws, a package for Amazon Web Services in R
Stars: ✭ 145 (-74.96%)
Mutual labels:  aws, aws-sdk
Angular Aws Amplify
Sample implementation for AWS Amplify in Angular project
Stars: ✭ 40 (-93.09%)
Mutual labels:  aws, aws-sdk
Go Sqs Poller
An AWS SQS Poller
Stars: ✭ 50 (-91.36%)
Mutual labels:  aws, aws-sdk
Rusoto
AWS SDK for Rust
Stars: ✭ 2,470 (+326.6%)
Mutual labels:  aws, aws-sdk
Aws Sdk Java
The official AWS SDK for Java.
Stars: ✭ 3,662 (+532.47%)
Mutual labels:  aws, aws-sdk

Soto for AWS

Swift 5.1 sswg:sandbox|94x20

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

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.

    dependencies: [
        .package(url: "https://github.com/soto-project/soto.git", from: "5.0.0")
    ],

Then add target dependencies for each of the Soto targets you want to use.

    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.

Compatibility

Soto works on Linux, macOS and iOS. It requires v2.0 of Swift NIO. If you use v1.0 of Swift NIO then you will need to use v3.5 of Soto. Below is a compatibility table for different Soto versions.

Version Swift MacOS iOS Linux Vapor
5.x 5.1 - 12.0 - Ubuntu 14.04-20.04 4.0
4.x 5.0 - 12.0 - Ubuntu 14.04-20.04 4.0
3.x 4.2 - Ubuntu 14.04-18.04 3.0

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.

Each Soto command returns a Swift NIO EventLoopFuture. An EventLoopFuture is not the response of the command, but rather a container object that will be populated with the response at a later point. In this manner calls to AWS do not block the main thread. It is recommended you familiarise yourself with the Swift NIO documentation, specifically EventLoopFuture if you want to take full advantage of Soto.

The recommended manner to interact with EventLoopFutures is chaining. The following function returns an EventLoopFuture that creates an S3 bucket, puts a file in the bucket, reads the file back from the bucket and finally prints the contents of the file. Each of these operations are chained together. The output of one being the input of the next.

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() -> EventLoopFuture<S3.GetObjectOutput> {
    // Create Bucket, Put an Object, Get the Object
    let createBucketRequest = S3.CreateBucketRequest(bucket: bucket)

    s3.createBucket(createBucketRequest)
        .flatMap { response -> EventLoopFuture<S3.PutObjectOutput> in
            // Upload text file to the s3
            let bodyData = "hello world".data(using: .utf8)!
            let putObjectRequest = S3.PutObjectRequest(
                acl: .publicRead,
                body: bodyData,
                bucket: bucket,
                key: "hello.txt"
            )
            return s3.putObject(putObjectRequest)
        }
        .flatMap { response -> EventLoopFuture<S3.GetObjectOutput> in
            let getObjectRequest = S3.GetObjectRequest(bucket: bucket, key: "hello.txt")
            return s3.getObject(getObjectRequest)
        }
        .whenSuccess { response in
            if let body = response.body {
                print(String(data: body, encoding: .utf8)!)
            }
    }
}

Documentation

API Reference

Visit soto.codes to browse the user guides and api reference. As there is a one-to-one correspondence with AWS REST api calls and the Soto api calls, you can also use the official AWS documentation for more detailed information about AWS commands.

User guides

Additional user guides for specific elements of Soto are available

Contributing

We welcome and encourage contributions from all developers. Please read CONTRIBUTING.md for our contributing guidelines.

License

Soto is released under the Apache License, Version 2.0. See LICENSE for details.

Backers

Support development of Soto by becoming a backer

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].