Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

Latest commit

 

History

History
44 lines (35 loc) · 1.04 KB

README.md

File metadata and controls

44 lines (35 loc) · 1.04 KB

Kotlin Coroutines for AWS Java SDKs

Provides coroutine builders to execute AWS Java SDK commands as asynchronous or blocking via awsCoroutine and awsBlockingCoroutine respectively.

Example

val client: AmazonEC2 = buildAmazonEC2Client()

// Launch a new instance for every custom AMI in the current account
with(CoroutineScope(Dispatchers.IO + Job())) {
    // suspends until the SDK command has completed
    suspendCommand(client::describeImages) {
        DescribeImagesRequest()
            .withOwners("self")
    }.images.map { image ->
        // launch SDK commands in parallel
        async {
            suspendCommand(client::runInstances) {
                RunInstancesRequest(image.imageId, 1, 1)
            }
        }
    }.awaitAll()
}

Installation

This library is available via JitPack:

repositories {
    maven("https://jitpack.io")
}

Add it as a project dependency:

dependencies {
    implementation("com.github.bradynpoulsen", "aws-sdk-kotlin-coroutines", awsCoroutinesVersion)
}