Database Reference
In-Depth Information
// Adding range key and value
item.put("recordId", new
AttributeValue().withS("productName"));
// Adding actual data for corresponding key
item.put("data", new AttributeValue().withSS("BMW Z"));
// Invoke put item request with proper table name
PutItemRequest putItemRequest = new
PutItemRequest("ProductTable", item);
// process the request
PutItemResult putItemResult =
dynamoClient.putItem(putItemRequest);
We have already seen multiple times how to create a DynamoDB client and configure it
with your own AWS credentials.
iOS
To perform the same operation on an iOS platform, you need to write something like this:
// create put item request
DynamoDBPutItemRequest *putItemRequest =
[DynamoDBPutItemRequest new];
// Set table name
request.tableName = @"ProductTable";
// create DynamoDBAttributeValue for hash key
DynamoDBAttributeValue *value = [[DynamoDBAttributeValue
alloc] initWithS:@"123"];
[request.item setValue:value forKey:@"productId"];
//create and set range key
value = [[DynamoDBAttributeValue alloc]
initWithS:@"ProductName"];
[request.item setValue:value forKey:@"recordId"];
Search WWH ::




Custom Search