$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
AWS SDK for Java version 2 - NYJavaSIG 2019-11-21
Search
sullis
November 21, 2019
Programming
0
120
AWS SDK for Java version 2 - NYJavaSIG 2019-11-21
AWS SDK for Java version 2.x
NY JavaSIG
November 21, 2019
#nyjavasig
#awscloud
#awssdk
#java
sullis
November 21, 2019
Tweet
Share
More Decks by sullis
See All by sullis
Dependency Management for Java - Seattle 2025-11-18
sullis
0
13
Dependency Management for Java - Portland - 2025-11-04
sullis
0
13
Dependency management for Java applications 2025-09-11
sullis
0
22
S3 NYC Iceberg meetup 2025-07-10
sullis
0
46
Amazon S3 Chicago 2025-06-04
sullis
0
120
Amazon S3 Boston 2025-05-07
sullis
0
77
Netty ConFoo Montreal 2025-02-27
sullis
0
120
GitHub Actions ConFoo Montreal 2025-02-26
sullis
0
84
Netty Portland Java User Group 2025-02-18
sullis
0
26
Other Decks in Programming
See All in Programming
AIコーディングエージェント(skywork)
kondai24
0
200
AtCoder Conference 2025「LLM時代のAHC」
imjk
2
570
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
170
[AtCoder Conference 2025] LLMを使った業務AHCの上⼿な解き⽅
terryu16
5
700
Kotlin Multiplatform Meetup - Compose Multiplatform 외부 의존성 아키텍처 설계부터 운영까지
wisemuji
0
120
Go コードベースの構成と AI コンテキスト定義
andpad
0
140
AIエージェントの設計で注意するべきポイント6選
har1101
5
2.1k
令和最新版Android Studioで化石デバイス向けアプリを作る
arkw
0
440
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
250
「コードは上から下へ読むのが一番」と思った時に、思い出してほしい話
panda728
PRO
39
26k
LLMで複雑な検索条件アセットから脱却する!! 生成的検索インタフェースの設計論
po3rin
4
960
AIの誤りが許されない業務システムにおいて“信頼されるAI” を目指す / building-trusted-ai-systems
yuya4
6
3.9k
Featured
See All Featured
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.1k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
27
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
70k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3k
Statistics for Hackers
jakevdp
799
230k
Practical Orchestrator
shlominoach
190
11k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
0
180
Documentation Writing (for coders)
carmenintech
77
5.2k
Designing Powerful Visuals for Engaging Learning
tmiket
0
190
Building Flexible Design Systems
yeseniaperezcruz
330
39k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
0
31
Making the Leap to Tech Lead
cromwellryan
135
9.7k
Transcript
Sean Sullivan November 21, 2019 NY JavaSIG AWS SDK for
Java version 2.x
software engineer Portland Oregon Java Scala About me
Agenda SDK for Java 2.x SDK internals Migrating from v1
to v2 Scala and SDK v2
AWS SDK for Java
SDK v2 announced June 2017 @awsforjava
“Under the hood, we use an HTTP client built on
top of Netty to make the non- blocking HTTP call” “first class support for non-blocking I/O in our async clients” source: AWS Developer Blog
“The AWS SDK for Java 2.0 asynchronous client methods return
CompletableFuture objects” source: SDK v2 Developer Guide
import java.util.concurrent.CompletableFuture; DynamoDBAsyncClient client = DynamoDBAsyncClient.builder() .region(Region.US_WEST_2) .build(); CompletableFuture<ListTablesResponse> response
= client.listTables(ListTablesRequest.builder().build()); CompletableFuture<List<String>> tableNames = response.thenApply(ListTablesResponse::tableNames); tableNames.whenComplete((tables, err) -> { if (tables != null) { tables.forEach(System.out::println); } else { err.printStackTrace(); } }); SDK v2
Github projects aws-sdk-java aws-sdk-java-v2
SDK v2
Pull Request
SDK v2 Maven artifacts
https://search.maven.org/
<dependency> <groupId>com.amazonaws<groupId> <artifactId>aws-java-sdk-dynamodb</artifactId> <version>1.11.679</version> </dependency> Maven dependencies SDK v1 <dependency>
<groupId>software.amazon.awssdk<groupId> <artifactId>dynamodb</artifactId> <version>2.10.20</version> </dependency> SDK v2
import com.amazonaws.services.cloudwatch.AmazonCloudWatchClient; import com.amazonaws.services.cloudwatch.AmazonCloudWatchClientBuilder; import com.amazonaws.services.cloudwatch.model.MetricDatum; import com.amazonaws.services.cloudwatch.model.PutMetricDataRequest; Java packages
SDK v1 import software.amazon.awssdk.services.cloudwatch.CloudWatchAsyncClient; import software.amazon.awssdk.services.cloudwatch.model.MetricDatum; import software.amazon.awssdk.services.cloudwatch.model.PutMetricDataRequest; SDK v2
distinct Maven artifact names distinct Java package names SDK v2
and SDK v1 can co-exist in a Java application SDK v1 jar SDK v2 jar
SDK v2 programming API • Immutable clients and models •
Enhanced pagination • Smart configuration merging • Forward-compatible enums • Streaming operations as first-class concepts
SDK internals
<slf4j.version>1.7.28</slf4j.version> <jackson.version>2.10.0</jackson.version> <netty.version>4.1.42.Final</netty.version> Transitive dependencies
“To provide SDK support for the many services that AWS
owns, the AWS SDKs make extensive use of code generation” Code generation https://aws.amazon.com/blogs/developer/aws-sdk-for-java-2-x-released/
Why code generation?
less boilerplate more consistency Why code generation?
class names parameter names method names exception names Consistency error
handling logging JSON serialization network I/O
AWS SDK for Java v2
JavaPoet AWS SDK for Java v2
Migrating code from v1 to v2
aws-secretsmanager-caching-java
https://github.com/aws/aws-secretsmanager-caching-java/
“AWS Secrets Manager Java caching client enables in-process caching of
secrets for Java applications” aws-secretsmanager-caching-java
aws-secretsmanager-caching-java is based on AWS SDK v1
https://github.com/aws/aws-secretsmanager-caching-java/issues/
how to migrate aws-secretsmanager- caching-java from SDK v1 to SDK
v2 ?
https://github.com/ aws/aws- secretsmanager- caching-java/pull/6
https://github.com/aws/aws-secretsmanager-caching-java/pull/6/files
https://github.com/aws/aws-secretsmanager-caching-java/pull/6/files
Scala and AWS SDK v2
val awsSdkVersion = “2.10.20” "org.scala-lang.modules" %% "scala-java8-compat" % “0.9.0", "software.amazon.awssdk"
% "cloudwatch" % awsSdkVersion, "software.amazon.awssdk" % "dynamodb" % awsSdkVersion build.sbt
import scala.compat.java8.FutureConverters._ import scala.collection.JavaConverters._
FutureConverters?
java.util.concurrent.CompletableFuture scala.concurrent.Future
FutureConverters.scala
migrating a Scala library from AWS SDK v1 to v2
“A tiny Scala wrapper around AWS CloudWatch Java client” gfc-aws-cloudwatch
https://github.com/gilt/gfc-aws-cloudwatch
https://github.com/ gilt/gfc-aws- cloudwatch/pull/8/ files
None
None
Conclusion SDK v1 — production ready SDK v2 — production
ready github.com/aws twitter.com/awsforjava
The end
None
Bonus material
“Hands-on in the AWS Java Ecosystem” AWS re:Invent 2018
“Developing Applications on AWS in the JVM” AWS re:Invent 2017
https://www.slideshare.net/AmazonWebServices/ dev205developing-applications-on-aws-in-the-jvm