Swiftpack.co - Package - swift-aws/aws-sdk-swift

aws-sdk-swift

AWS SDK for the Swift programming language. This library doesn't depend on Objective-C Runtime, So you can use this with Linux.

Supported Platforms and Swift Versions

| | Swift 4.1 | |---|:---:| |macOS | ○ | |Ubuntu 14.04 | ○ | |Ubuntu 16.04 | ○ |

Documentation

Visit the aws-sdk-swift documentation for instructions and browsing api references.

Installation

Swift Package Manager

Package.swift

import PackageDescription

let package = Package(
    name: "MyAWSApp",
    dependencies: [
        .package(url: "https://github.com/swift-aws/aws-sdk-swift.git", from: "1.0.0")
    ]
)

Carthage

Not supported yet

Cocoapods

Not supported yet

Contributing

All developers should feel welcome and encouraged to contribute to aws-sdk-swift.

As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.

To contribute a feature or idea to aws-sdk-swift, submit an issue and fill in the template. If the request is approved, you or one of the members of the community can start working on it.

If you find a bug, please submit a pull request with a failing test case displaying the bug or create an issue.

If you find a security vulnerability, please contact yuki@miketokyo.com and reach out on the #aws channel on the Vapor Discord as soon as possible. We take these matters seriously.

Configuring Credentials

Before using the SDK, ensure that you've configured credentials.

Via EC2 Instance Profile

If you are running your code on an AWS EC2 instance, you can setup an IAM role as the server's Instance Profile to automatically grant credentials via the metadata service.

There are no code changes or configurations to specify in the code, it will automatically pull and use them.

Load Credentials from shared credential file.

Not supported yet

Load Credentials from Environment Variable

Alternatively, you can set the following environment variables:

AWS_ACCESS_KEY_ID=bar
AWS_SECRET_ACCESS_KEY=foo

Pass the Credentials to the AWS Service struct directly

All of the AWS Services's initializers accept accessKeyId and secretAccessKey

let ec2 = EC2(
    accessKeyId: "Your-Access-Key",
    secretAccessKey: "Your-Secret-Key"
)

Using the aws-sdk-swift

import AWSSDKSwift

do {
    let bucket = "my-bucket"

    let s3 = S3(
        accessKeyId: "Your-Access-Key",
        secretAccessKey: "Your-Secret-Key",
        region: .apnortheast1
    )

    // Create Bucket
    let createBucketRequest = S3.CreateBucketRequest(bucket: bucket)
    _ try s3.createBucket(createBucketRequest)

    // Upload text file to the s3
    let bodyData = "hello world".data(using: .utf8)!
    let putObjectRequest = S3.PutObjectRequest(bucket: bucket, contentLength: Int64(bodyData.count), key: "hello.txt", body: bodyData, acl: .publicRead)
    _ = try s3.putObject(putObjectRequest)

    // Get text file from s3
    let getObjectRequest = S3.GetObjectRequest(bucket: bucket, key: "hello.txt")
    let getObjectOutput = try s3.getObject(getObjectRequest)
    if let body = getObjectOutput.body {
      print(String(data: body, encoding: .utf8))
    }
} catch {
    print(error)
}

Speed Up Compilation

Compiling the entire aws-sdk-swift requires a certain amount of time (of course, dependes on machine spec). And we know 97% of users don't need to install all of the service SDKs.

In order to answer such a request, we will provide SDK for each service as a separate SwiftPM package.

https://github.com/swift-aws

From here, it's possible to select and install only the SDKs of the service to be used in your application.

License

aws-sdk-swift is released under the Apache License, Version 2.0. See LICENSE for details.

Github

link
Stars: 56
Help us keep the lights on

Used By

Total: 0

Releases

1.1.6 - Aug 7, 2018

1.1.5 - Apr 14, 2018

1.1.4 - Apr 13, 2018

1.1.3 - Dec 10, 2017

Addings

AWSMigrationHub Cloud9 GuardDuty SageMaker alexaforbusiness appsync ce cloudhsmv2 comprehend glue iot-jobs-data kinesis-video-archived-media kinesis-video-media kinesisvideo mediaconvert medialive mediapackage mediastore-data mediastore mobile mq pricing resource-groups runtime.sagemaker serverlessrepo translate

Updatings

acm acm apigateway application-autoscaling appstream athena autoscaling batch budgets clouddirectory cloudformation cloudfront cloudhsm cloudsearch cloudsearchdomain cloudtrail codebuild codecommit codedeploy codepipeline codestar cognito-identity cognito-idp cognito-sync config cur datapipeline dax devicefarm directconnect discovery dms ds dynamodb ec2 ecr ecs elasticache elasticbeanstalk elasticfilesystem elasticloadbalancing elasticloadbalancingv2 elasticmapreduce elastictranscoder email entitlement.marketplace es events firehose gamelift glacier greengrass health iam importexport inspector iot-data iot kinesis kinesisanalytics kms lambda lex-models lightsail logs machinelearning marketplacecommerceanalytics meteringmarketplace mobileanalytics monitoring mturk-requester opsworks opsworkscm organizations pinpoint polly rds redshift rekognition resourcegroupstaggingapi route53 route53domains runtime.lex s3 sdb servicecatalog shield sms snowball sns sqs ssm states storagegateway streams.dynamodb sts support swf waf-regional waf workdocs workspaces xray

1.1.2 - Nov 17, 2017