The Stack

Kotlin, used for Prime Video applications, gets its own AWS SDK

A new AWS software development kit (SDK) for Kotlin lets developers call AWS services using idiomatic Kotlin APIs for the first time. The release comes as the programming language continues to gain in popularity after being made the preferred code for Android development by Google in 2019.

It’s an alpha release at this stage (i.e. not for prod) but the aim of AWS is to offer better mobile support and let developers “target multiple platforms and execution environments in a single language” the hyperscaler said. The release comes four months after it also rolled out the alpha release of a new SDK for Rust.

Amazon itself Amazon has used Kotlin to write a new application called Prime Video Profiles, which helps users access customised recommendations. The microservices underpinning this featured needed to support “thousands of requests per second per host while maintaining high availability. The requests would be I/O heavy, and asynchronous (non-blocking) programming would improve application throughput by increasing parallelization, and reducing I/O wait-times from blocking subsequent execution,” AWS earlier noted.

“This can be done in Java using Futures, but they quickly become complex if there are multiple dependent calls, and all failure scenarios need to be evaluated. Kotlin coroutines improve this process. They can be thought of as lightweight threads and are more readable,” an AWS team added in a May 2021 case study.

See also: Born at China’s WeBank, now incubating in the ASF: Introducing Apache EventMesh

Kotlin is notably more concise than Java, averaging a 40% cut in the number of lines of code needed. The open source language, first developed by JetBrains, claims to be more type-safe, e.g. support for non-nullable types makes applications less prone to NPE’s — exceptions that occur when you try to use a reference that points to no location in memory (null) as though it were referencing an object, triggering (sometimes exploitable) errors.

“Other features including smart casting, higher-order functions, extension functions and lambdas with receivers provide the ability to write expressive code as well as facilitating creation of DSL,” Kotlin says.

“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,” said AWS’s Aaron Todd, Ian Botsford, and Ken Gilmer in an August 30 blog.

“[The] 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.

(Want to learn Kotlin? JetBrains Academy’s currently offering a free programme “Kotlin Basics” that presents 10 real-world projects of different proficiency levels, over 120 educational topics, and more than 300 coding challenges. Sign up here.)

Follow The Stack on LinkedIn

Exit mobile version