AWS Developer Tools Blog
Announcing new AWS SDK for Kotlin alpha release
We’re excited to announce the alpha release of the new AWS SDK for Kotlin! Kotlin is one of the most-loved languages amongst developers and now the AWS SDK for Kotlin makes it easy to call AWS services using idiomatic Kotlin APIs. You can use the native Kotlin language constructs you are used to, have mobile support without compromises, and target multiple platforms and execution environments in a single language.
We designed the SDK from the ground up to give customers a familiar Kotlin experience, including concise yet expressive DSL builders and asynchronous AWS service calls via Kotlin coroutines. Today’s alpha release enables developers to make API calls to all the supported AWS services. Additionally, you may target the JVM platform or Android API Level 24+, with support for additional platforms like JavaScript and Native coming in future releases. To track the upcoming features in the future releases, please see our public roadmap on GitHub.
Today’s alpha release marks an important point in our journey, but the SDK is still in the early stages of development. This is a great time to influence our roadmap by sharing your thoughts on the SDK design with us, as well as features and services that are the most important to you. Your feedback matters to us. See the section below on all the ways you can contribute.
Getting Started with the AWS SDK for Kotlin
This example shows how to perform a simple Amazon DynamoDB operation using the SDK for Kotlin. More detailed examples are available in the the GitHub repository as well as the developer guide.
1. Create a new Kotlin (JVM) project using your favorite IDE.
2. Add dependencies for Amazon DynamoDB and coroutines. This example assumes you are using Gradle. If you are using another build system, consult your build tool documentation on how to configure dependencies.
plugins {
kotlin("jvm") version "1.5.20"
}
repositories {
mavenCentral()
}
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0")
implementation("aws.sdk.kotlin:dynamodb:0.4.0-alpha")
}
3. Configure your AWS credentials. See the configure quickstart guide for an introduction. Note: At this time, we support the default credential chain including config file, environment variables, and AWS profile.
4. Create a service client and make an Amazon ‘DynamoDB request (the example below lists all existing Amazon DynamoDB tables to the console):
import kotlinx.coroutines.runBlocking
import aws.sdk.kotlin.services.dynamodb.DynamoDbClient
fun main() = runBlocking {
val client = DynamoDbClient { region = "us-east-2" }
val resp = client.listTables {
limit = 10
}
println("Current DynamoDB tables: ")
resp.tableNames?.forEach { println(it) }
client.close()
}
For more information on getting started, see the developer guide as well as our README. If you are new to Kotlin, the official language page is a great place to start.
Contributing to the SDK’s development
Make sure to check out the Contributing guide to get the latest information. Here’s how you can help and provide feedback:
- Try out the SDK and let us know how it could be improved – For services the SDK supports, let us know if you have improvement ideas by submitting a GitHub feature request. Be sure to add your comments and “+1” GitHub issues that have already been submitted to help us prioritize and plan effectively.
- Report defects – If you find a bug or encounter unexpected behavior, let us know by submitting a GitHub issue or pull request.
- Review the docs – We want to ensure that our documentation provides all the necessary information and is easy to follow. If you find the areas that are unclear or incomplete, open an issue, or even better, submit a PR.
- Help us prioritize high-level abstractions– Beyond the core SDK, high-level abstractions built on top of the SDK (like the S3 Encryption Client or the DynamoDB Mapper) can further simplify usage of AWS services. Let us know which use cases are most important to you or provide ideas for new libraries.
Give it a Try!
The developer guide is a great place to start using the SDK. Check it out and let us know what you think!