getItem

abstract suspend fun getItem(input: GetItemRequest): GetItemResponse

The GetItem operation returns a set of attributes for the item with the given primary key. If there is no matching item, GetItem does not return any data and there will be no Item element in the response.

GetItem provides an eventually consistent read by default. If your application requires a strongly consistent read, set ConsistentRead to true. Although a strongly consistent read might take more time than an eventually consistent read, it always returns the last updated value.

Samples

import aws.sdk.kotlin.services.dynamodb.model.AttributeValue
fun main() { 
   //sampleStart 
   // This example retrieves an item from the Music table. The table has a partition key and a sort key
// (Artist and SongTitle), so you must specify both of these attributes.
val resp = dynamoDbClient.getItem {
    tableName = "Music"
    key = mapOf<String, AttributeValue>(
        "Artist" to AttributeValue.S("Acme Band"),
        "SongTitle" to AttributeValue.S("Happy Day")
    )
} 
   //sampleEnd
}