LaunchSpecification
object (sdk docs)
I am trying to push event on Amazon eventbridge using EventBridgeClient class. I have created an @Restcontroller and followed the code and response json from the link below-
https://docs.aws.amazon.com/eventbridge/latest/userguide/add-events-putevents.html
But after hitting the api from postman I am getting the errror of
EventBridgeException: Unsupported Mediatype(Service: Eventbridge, Status code:415, Extended request Id: null)
Can someone please help me?
Hi There,
I am facing a strange issue when I try to put objects with software.amazon.awssdk-S3 In java batch job environments. I am supposed to write a file to S3 in my writer job.
My thread disappears once it hit this line of code.
s3Client = S3Client.builder().region(getS3Region()).build();
No error log or anything.
Just look like the thread hang and after sometime thread start to execute from the beginning.
The most strange thing is my code working fine in my local machine and the issue only persists in the ec2.
I can only see bellow two logs
Putting Object to S3
public void putObject(String fileName, byte[] br) {
LOGGER.debug("Putting Object to S3");
try (S3Client s3Client = S3Client.builder().region(getS3Region()).build()) {
LOGGER.debug("just before PutObjectRequest.build.");
PutObjectRequest request = PutObjectRequest.builder().bucket(getS3BucketName()).key(fileName).build();
LOGGER.debug("just before putObject call.");
s3Client.putObject(request, RequestBody.fromBytes(br));
LOGGER.debug("just after put Object Completed.");
} catch (Exception ex) {
LOGGER.error(ex);
throw ex;
} finally {
LOGGER.debug("IN finally block");
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("put Object Completed.");
}
}
Hello All,
Any pointers on Generics with EnhancedDynamoDB?
eg.
DynamoDbEnhancedClient client = DynamoDbEnhancedClient.create();
DynamoDbTable<Person> people = client.table("people", TableSchema.fromBean(Person.class));
I want to generalize this statements, such that I can use the DynamoDbTable with any bean not specifically with "people " bean.
I was hoping one wouldn't need to be in the proper Region for a Bucket, if making a call to get the Buck information. However, it seems to throw a malformed header authorization error if I'm in one Region and asking for the location of a Bucket in another Region. Shouldn't that call be agnostic to the current region since we don't know what region to make the client in, in order to make the call to ask the location of the Bucket? My code is simple enough:
GetBucketLocationRequest bucketLocationRequest = GetBucketLocationRequest.builder().bucket(bucketName).build();
GetBucketLocationResponse bucketLocationResponse = getClient().getBucketLocation(bucketLocationRequest);
and the error is The authorization header is malformed; the region 'us-east-1' is wrong; expecting 'us-west-2'
. Should I be using a different API call?
Hi guys am trying to use the aws java sdk 2, specifically the sqs library but seeing the below errorval sqsClient: SqsAsyncClient = SqsAsyncClient.builder().build()
Static methods in interface require -target:jvm-1.8.
I am on java 8, would anyone have an idea of what I might be doing wrong. Thanks
Hi guys. I'm struggling with the sdk java v2 to create a lambda (actually I have the v1 version to migration to v2). I saw an older discussion about the RequestHandler and Context object. Can't find anything on the internet. Any idea what is the equivalent in v2 ?
@cornelcroi the library that defines RequestHandler and Context objects is not linked to an AWS SDK version. The same library can be used with SDK 2.
Hi Team, I'm working on migration from v1 to v2. I would like to reduce dependencies tree as much as possible, to get package size smaller and AWS Lambda run faster.
I'm struggling with requests handling. I see older discussions on similar topic. Has anything changed?
I'm looking for equivalent implementation if about RequestStreamHandler.handleRequest(InputStream input, OutputStream output, Context context)
. This is a member of aws-lambda-java-core-1.2.1
.
Is it still the way for SDK2?
If not, what is the correct way of implementing it with API v2?
Including the slf4j libraries add about 5 seconds overhead in a lambda I am developing.
Excluding that gives me a warning of:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
What would be the best way to remove this while saving me overhead on execution
https://docs.aws.amazon.com/lambda/latest/dg/java-logging.html
if you need simple logging just use Sys out or the logger included in the SDK
Hi @all @team I have upgraded the version for awssdk % s3
val s3Sdk = "software.amazon.awssdk" % "s3" % 2.15.28
from
val s3Sdk = "com.amazonaws" % "aws-java-sdk-s3" % "1.11.566"
to bump up the version for KCL to version 2 and now getting this exception -
[prefetch-cache-shardId-000000000000-0000] ERROR software.amazon.kinesis.retrieval.polling.PrefetchRecordsPublisher - shardId-000000000000 : Exception thrown while fetching records from Kinesis
software.amazon.awssdk.core.exception.SdkClientException: Unable to parse date : 1.605551544253E9
any idea what can be the issue, I am passing the same message which was getting processed before with older version
aws-crt-client
, I got an exception crashing the jvmFatal error condition occurred in C:\Program Files (x86)\Jenkins\workspace\aws-crt-java-build-dll-win64\aws-crt-java\aws-common-runtime\aws-c-io\source\host_resolver.c:541: err_code != AWS_ERROR_SUCCESS || aws_array_list_length(&callback_address_list) > 0
Exiting Application
at 0x7FFC23F82897: Java_software_amazon_awssdk_crt_http_HttpClientConnectionManager_httpClientConnectionManagerAcquireConnection
at 0x7FFC23F82897: Java_software_amazon_awssdk_crt_http_HttpClientConnectionManager_httpClientConnectionManagerAcquireConnection
at 0x7FFC23F82897: Java_software_amazon_awssdk_crt_http_HttpClientConnectionManager_httpClientConnectionManagerAcquireConnection
at 0x7FFC23F82897: Java_software_amazon_awssdk_crt_http_HttpClientConnectionManager_httpClientConnectionManagerAcquireConnection
at 0x7FFC23F82897: Java_software_amazon_awssdk_crt_http_HttpClientConnectionManager_httpClientConnectionManagerAcquireConnection
at 0x7FFC698E7020: BaseThreadInitThunk
at 0x7FFC69A1CEA0: RtlUserThreadStart
mvn install -P quick
and I'm getting the error below. I'm using Ubuntu, Java 8, Maven 3.6.3[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:exec (map-service-to-client-prefix) on project archetype-lambda: Command execution failed.: Cannot run program "python" (in directory "/home/dgood/IdeaProjects/aws-sdk-java-v2/archetypes/archetype-lambda"): error=2, No such file or directory -> [Help 1]
START RequestId: d09b0430-8c4f-4801-834e-99c75d8345b6 Version: $LATEST
Unable to load an HTTP implementation from any provider in the chain. You must declare a dependency on an appropriate HTTP implementation or pass in an SdkHttpClient explicitly to the client builder.: software.amazon.awssdk.core.exception.SdkClientException
software.amazon.awssdk.core.exception.SdkClientException: Unable to load an HTTP implementation from any provider in the chain. You must declare a dependency on an appropriate HTTP implementation or pass in an SdkHttpClient explicitly to the client builder.
at software.amazon.awssdk.core.exception.SdkClientException$BuilderImpl.build(SdkClientException.java:97)
at software.amazon.awssdk.core.internal.http.loader.DefaultSdkHttpClientBuilder.lambda$buildWithDefaults$1(DefaultSdkHttpClientBuilder.java:49)
at java.util.Optional.orElseThrow(Optional.java:290)
at software.amazon.awssdk.core.internal.http.loader.DefaultSdkHttpClientBuilder.buildWithDefaults(DefaultSdkHttpClientBuilder.java:43)
at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.lambda$resolveSyncHttpClient$4(SdkDefaultClientBuilder.java:244)
at java.util.Optional.orElseGet(Optional.java:267)
at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.resolveSyncHttpClient(SdkDefaultClientBuilder.java:244)
at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.finalizeSyncConfiguration(SdkDefaultClientBuilder.java:209)
at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.syncClientConfiguration(SdkDefaultClientBuilder.java:147)
at software.amazon.awssdk.services.sts.DefaultStsClientBuilder.buildClient(DefaultStsClientBuilder.java:27)
at software.amazon.awssdk.services.sts.DefaultStsClientBuilder.buildClient(DefaultStsClientBuilder.java:22)
at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.build(SdkDefaultClientBuilder.java:118)
at audit.AuditLambda.<init>(AuditLambda.java:31)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
END RequestId: d09b0430-8c4f-4801-834e-99c75d8345b6
REPORT RequestId: d09b0430-8c4f-4801-834e-99c75d8345b6 Duration: 58.81 ms Billed Duration: 59 ms Memory Size: 512 MB Max Memory Used: 109 MB Init Duration: 1314.24 ms
Unable to load an HTTP implementation from any provider in the chain. You must declare a dependency on an appropriate HTTP implementation or pass in an SdkHttpClient explicitly to the client builder.
software.amazon.awssdk.core.exception.SdkClientException
Hello All,
Any pointer on how to update/set a specific attribute value in a DynamoDB versioned table using aws-sdk-java-v2?
Also how one can use enhanced client with timed-series DynamoDB tables (eg. TestResultsOCT2020, TestResultsNOV2020 etc. Here the associated java entity class would be "TestResults" without time-series and not "TestResultsOCT2020" )
Hello All,
Any Idea how I can get GSI (global secondary indexes) associated with @DynamoDbSecondaryPartitionKey using sdkV2 enhanced DynamoDB client?
TableSchema.fromBean(clazz).tableMetadata().indices() does provide IndexMetadata (name, primary & sortkey), but does not reveal any association with @DynamoDbSecondaryPartitionKey or @DynamoDbSecondarySortKey, either.
Caused by: java.util.concurrent.CompletionException: java.io.IOException: Server failed to send complete response
at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292)
at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308)
at java.util.concurrent.CompletableFuture.uniCompose(CompletableFuture.java:943)
at java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:926)
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977)
at software.amazon.awssdk.core.internal.http.async.CombinedResponseAsyncHttpResponseHandler.onError(CombinedResponseAsyncHttpResponseHandler.java:67)
at software.amazon.awssdk.core.internal.http.async.AsyncAfterTransmissionInterceptorCallingResponseHandler.onError(AsyncAfterTransmissionInterceptorCallingResponseHandler.java:72)
at software.amazon.awssdk.core.internal.http.pipeline.stages.MakeAsyncHttpRequestStage$WrappedErrorForwardingResponseHandler.onError(MakeAsyncHttpRequestStage.java:159)
at software.amazon.awssdk.http.nio.netty.internal.ResponseHandler.lambda$notifyIfResponseNotCompleted$2(ResponseHandler.java:401)
at software.amazon.awssdk.http.nio.netty.internal.ResponseHandler.runAndLogError(ResponseHandler.java:180)
at software.amazon.awssdk.http.nio.netty.internal.ResponseHandler.notifyIfResponseNotCompleted(ResponseHandler.java:401)
at software.amazon.awssdk.http.nio.netty.internal.ResponseHandler.channelInactive(ResponseHandler.java:152)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)
at io.netty.handler.logging.LoggingHandler.channelInactive(LoggingHandler.java:197)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)
at io.netty.channel.ChannelInboundHandlerAdapter.channelInactive(ChannelInboundHandlerAdapter.java:81)
at io.netty.handler.timeout.IdleStateHandler.channelInactive(IdleStateHandler.java:277)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)
at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelInactive(CombinedChannelDuplexHandler.java:418)
at io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:386)
at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:351)
at io.netty.handler.codec.http.HttpClientCodec$Decoder.channelInactive(HttpClientCodec.java:288)
at io.netty.channel.CombinedChannelDuplexHandler.channelInactive(CombinedChannelDuplexHandler.java:221)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)
at io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:386)
at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:351)
at io.netty.handler.ssl.SslHandler.channelInactive(SslHandler.java:1084)
at io.netty.channel.AbstractChannelHandlerCon
final SdkEventLoopGroup sdkEventLoopGroup;
if (Epoll.isAvailable()) {
sdkEventLoopGroup = SdkEventLoopGroup.create(new EpollEventLoopGroup(eventLoopGroupThreads), HttpClientConfiguration::createEpollSocketChannel);
} else {
sdkEventLoopGroup = SdkEventLoopGroup.create(new NioEventLoopGroup(eventLoopGroupThreads), HttpClientConfiguration::createNioSocketChannel);
}
final NettyNioAsyncHttpClient.Builder nettyNioAsyncHttpClientBuilder = NettyNioAsyncHttpClient.builder()
.connectionMaxIdleTime(connectionMaxIdleTime)
.connectionAcquisitionTimeout(connectionAcquisitionTimeout)
.connectionTimeout(connectionTimeout)
.readTimeout(readTimeout)
.maxConcurrency(maxConnections)
.maxPendingConnectionAcquires(maxPendingConnectionAcquires)
.eventLoopGroup(sdkEventLoopGroup)
.sslProvider(OpenSsl.isAvailable() ? SslProvider.OPENSSL : SslProvider.JDK);
log.info("Netty async http client - openssl: {} - epoll: {}", OpenSsl.isAvailable(), Epoll.isAvailable());
if (!OpenSsl.isAvailable()) {
log.info("OpenSSL reason: {}", OpenSsl.unavailabilityCause().getMessage(), OpenSsl.unavailabilityCause());
}
if (!Epoll.isAvailable()) {
log.info("Epoll reason: {}", NestedExceptionUtils.getMostSpecificCause(Epoll.unavailabilityCause()).getMessage());
}
return nettyNioAsyncHttpClientBuilder.build();
final S3AsyncClientBuilder clientBuilder = S3AsyncClient.builder()
.httpClient(asyncHttpClient)
.region(region);
I searched for some online Javadoc and found 2 sources that both claim to be latest, for 2.15.68. For example for StsAssumeRoleCredentialsProvider.Builder:
https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/sts/auth/StsAssumeRoleCredentialsProvider.Builder.html
and
https://javadoc.io/doc/software.amazon.awssdk/sts/latest/software/amazon/awssdk/services/sts/auth/StsAssumeRoleCredentialsProvider.Builder.html
The first shows it extends Object. The second extends BaseBuilder and obviously supplies more methods.
Why are they different? What is the correct source?