Questions tagged [aws-java-sdk-2.x]

The AWS SDK for Java provides a Java API for Amazon Web Services. Using the SDK, you can easily build Java applications that work with Amazon S3, Amazon EC2, DynamoDB, and more.

Version 2.x is a major rewrite of the 1.11.x code base. Built with support for Java 8+, 2.x adds several frequently requested features, like nonblocking I/O, improved start-up performance and automatic iteration over paginated responses. In addition, many aspects of the SDK have been updated with a focus on consistency, immutability, and ease of use.

Links

125 questions
15
votes
2 answers

Get authentication token from AWS EKS using the AWS Java SDK v2

How can I get a Kubernetes authentication token from AWS EKS using the AWS Java SDK v2? An authentication token that can then be used to authenticate with Kubernetes using a Kubernetes SDK. In other words I want to get an authentication token from…
12
votes
2 answers

How to check if bucket already exists in AWS S3

How can I check if the bucket already exists in my Aws S3 account using Java SDK? Using below code AmazonS3ClientBuilder.defaultClient().doesBucketExistV2(bucketName); Checks global existence of bucket and returns true if a bucket with this…
12
votes
2 answers

Get an S3Object from a GetObjectResponse in AWS Java SDK 2.0

In AWS Java SDK 1.x, I could get an S3Object from an S3Client like this. S3Object obj = mS3Client.getObject(pBucket, pKey); I'm trying to replicate that functionality using AWS Java SDK 2.0 (and end up with an S3Object), but the closest I can get…
the_storyteller
  • 2,335
  • 1
  • 26
  • 37
10
votes
1 answer

Unmarshalling DynamoDB Map to document-style JSON in AWS Java SDK 2.x

The answers to the question Converting DynamoDB JSON to Standard JSON with Java are obsolete in 2022. The problem is that both of these imports no longer work: import com.amazonaws.services.dynamodbv2.document.internal.InternalUtils; import…
Alex R
  • 11,364
  • 15
  • 100
  • 180
9
votes
1 answer

AWS SDK Java version 2 - is there an equivalent to doesObjectExist() from ver 1?

The S3 client in the AWS Java SDK ver 1 had a method to check for the existence of an object in a bucket doesObjectExist(bucketName, objectName) In version 2 of the SDK I don't see anything similar but I wanted to see if I was missing anything. The…
menapole
  • 1,166
  • 1
  • 11
  • 22
8
votes
2 answers

deleteObjects using AWS SDK V2?

I'm trying to migrate from AWS SDK V1.x to V2.2. I can't figure out the deleteObjects method though. I've found a bunch of examples - all the same one :-( that doesn't appear to ever use the list of objects to delete (i.e. the list is present, but…
Todd
  • 2,829
  • 5
  • 34
  • 56
6
votes
1 answer

AWS SDK 2 assume role

@Bean public DynamoDbClient amazonDynamoDB() { final AssumeRoleRequest assumeRoleRequest = AssumeRoleRequest.builder().roleSessionName(UUID.randomUUID().toString()).roleArn("roleArn").build(); final StsAssumeRoleCredentialsProvider …
5
votes
1 answer

What is the difference between DynamoDBMapper and Table for DynamoDB Tables

In AWS DynamoDB, There are two options available to do the CRUD operations on the Table. DynamoDBMapper : com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper;. AmazonDynamoDB dbClient =…
5
votes
2 answers

How to Configure using STSAssumeRoleSessionCredentialsProvider with roleSessionName and roleArn for AWS SDK for Java 2.x?

Currently for AWS SDK for Java 1.x im using below code. @Configuration @ImportResource("classpath:aws-context.xml") public class AmazonS3Config { @Bean(destroyMethod = "shutdown") public AmazonS3Client…
5
votes
1 answer

Get an S3Object InputStream from a GetObjectResponse in AWS Java SDK 2 Using S3AsyncClient?

How can a plain InputStream be created using the S3AsyncClient for a getObject request? The S3AsyncClient for AWS JDK 2.0 does not seem to have a function that returns a ResponseInputStream the same way that the S3Client…
Ramón J Romero y Vigil
  • 17,373
  • 7
  • 77
  • 125
5
votes
2 answers

How to do auto script generation with AWS glue job with AWS java SDK

I am creating glue job creation using Java Sdk. It has only two required params Command and Glue version. But i need to create job with auto script generation. As we can do from console, we add data source, A proposed script generated by AWS Glue,…
5
votes
1 answer

Get AWS S3 bucket web static site URL programmatically using Java SDK v2

The documentation at https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteEndpoints.html says that there are two major forms based upon region: bucket-name.s3-website-region.amazonaws.com bucket-name.s3-website.region.amazonaws.com (Note the…
Garret Wilson
  • 18,219
  • 30
  • 144
  • 272
4
votes
1 answer

AWS S3AsyncClient is giving credential issue while trying to read content from Object Storage

I am trying to use AWS S3AsyncClient to get/read file from Object Storage. My ultimate intention is to use this in my Vert.x project but before using with Vert.x I wanted to do get it working standalone. By following multiple forums I have written…
4
votes
3 answers

AWS Java SDK 2 S3 copy object

In the version 1 SDK, making a copy request was straightforward with: new CopyObjectRequest(sourceBucket, sourceKey, destinationBucket, destinationKey) In the version 2 SDK, the Builder for CopyObjectRequest does not have a clear way to set the…
worpet
  • 3,788
  • 2
  • 31
  • 53
3
votes
1 answer

Unable to execute HTTP request

I am trying to use java sdk to get list of aws ec2 instances and s3 bucketsattached to a user. My main program class is ` package com.aws.demo; import java.util.List; import org.springframework.boot.SpringApplication; import…
Oluchi
  • 41
  • 3
1
2 3
8 9