I’m trying to put an item into a DynamoDB table using the AWS SDK for Java. I am using the EnhancedPutItem.java example from the docs: When running locally I can put the item successfully, but when I run my application as a task on Fargate, it throws this error: software.amazon.awssdk.core.exception.SdkClientException: Profile file contained no credentials for profile ‘default’: ProfileFile(profilesAndSectionsMap=[]). Answer
Tag: amazon-dynamodb
DynamoDB Update Transaction Java
I’m trying to update my table in dynamo with an update transaction. I want to update a specific row if it is found. If it isn’t found I want to add a new row to the table. I found some sample Java code here: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/transaction-example.html From my understanding this code is updating the row IF the condition that the product
Mapping List to DynamoDB
I’m trying to map to DynamoDB list of dates in Java I have written my own converter but it works only for LocalDateTime but not for the List. Does anyone know how to do it correctly? Should I write separate converter that will return list of strings where each string will be converted from localdatetime? Answer I wrote converter like
Streams from DyanamoDB Mapper Single BatchSave operation triggering multiple events in lambda
I am using Java to insert multiple items into DynamoDB using batchSave method. The table has Streams enabled. I want the streams to trigger the lambda just once for a single batchSave. Should I be using some other Method to push multiple items in the DB? Thanks In Advance 🙂 Answer My issue got resolved by increasing the batchSize which
Dynamodb get a single item based on sort key only
I am new to dynamodb and I need to process 5M records. Each record has an id and a status. I need to query for each record based on its status, process it, and finally update the status. I am using DynamoDbEnhancedClient but I could not find example on how to query based only on the range and not the
Unable to connect to local dynamo-db instance in java
I am testing my application which uses dynamoDB. I have started an instance locally using docker and I’m able to create / add items in the instance. Now, inside my Java application, I am trying to connect to my local and when I’m sending an API call that interacts with my local Dynamo, it throws an error – Unable to
Query DynamoDb Global Secondary Index
i am trying out dynamodb locally and got the following table: I want to query it with Java like this: But it throws a Exception with “QUery Key Condition not supported”. I dont understand this, because in the docs, the “<” operator is described as regular operation. Can anybody help me Answer DDB Query() requires a key condition that includes
Java: unable to delete dynamodb item value
I am trying to delete a field called “dog” from all of the items that resides on table animals, or that I use the following code: But I am getting: What am I doing wrong here? by the way, I also tried: But got the same exception. (Also tried DELETE instead of REMOVE) Answer I found the solution for the
Converting POJO into map
I have a Java class having 10 attributes, I want to convert this into 3 maps(Breaking it into 5,3,2 fields resepectively). I did some research and found that Jackson’s ObjectMapper can be used by doing something like this: This will be creating a single map for all the attributes in my POJO. What I want is have this POJO converted
AWS JAVA dynamoDB enhanced client putItem class cast exception
When I used enhanced client to put but it throws class cast exception. It gives me error java.lang.ClassCastException: com.db.dynamo.Tableclass cannot be cast to com.db.dynamo.Tableclass Answer This worked for me SpringBoot – Java AWS SDK 2 DynamoDB Enhanced Client and devtools problem So basically the issue was with spring dev tools and its class loader(2 in number), so you can either