Official aws-lite
plugin for DynamoDB
Maintained by: @architect
Install
npm i @aws-lite/dynamodb
Optionally install types:
npm i -D @aws-lite/dynamodb-types
Reference
Reference documentation with examples at aws-lite.org
Methods
BatchExecuteStatement
Canonical AWS API doc
Properties:
Statements
(array) [required]
- Array of PartiQL statements representing the batch being run
ReturnConsumedCapacity
(string)
- Return throughput consumption in response, can be set to one of:
INDEXES
, TOTAL
, or NONE
BatchGetItem
Canonical AWS API doc
Properties:
RequestItems
(object) [required]
- An object containing >=1 table names and, for each table, an object describing >=1 items to get
ReturnConsumedCapacity
(string)
- Return throughput consumption in response, can be set to one of:
INDEXES
, TOTAL
, or NONE
BatchWriteItem
Canonical AWS API doc
Properties:
RequestItems
(object) [required]
- An object containing >=1 table names and, for each table, an object describing >=1 items to write
ReturnConsumedCapacity
(string)
- Return throughput consumption in response, can be set to one of:
INDEXES
, TOTAL
, or NONE
ReturnItemCollectionMetrics
(string)
- Return collection metrics in response, can be set to:
SIZE
, or NONE
(default)
CreateBackup
Canonical AWS API doc
Properties:
TableName
(string) [required]
BackupName
(string) [required]
- Specified name of the backup
CreateGlobalTable
Canonical AWS API doc
Properties:
GlobalTableName
(string) [required]
ReplicationGroup
(array) [required]
- AWS regions where the global table needs to be created
CreateTable
Canonical AWS API doc
Properties:
TableName
(string) [required]
AttributeDefinitions
(array) [required]
- Array of attributes that describe the primary (and sort) schema for the table
KeySchema
(array) [required]
- Attributes that make up the primary key for a table or index. The attributes in
KeySchema
must also be defined in the AttributeDefinitions
array
BillingMode
(string)
- Set how the table is charged for read/write throughput:
PROVISIONED
, or PAY_PER_REQUEST
DeletionProtectionEnabled
(boolean)
- Enable or disable deletion protection
GlobalSecondaryIndexes
(array)
LocalSecondaryIndexes
(array)
ProvisionedThroughput
(object)
- Provisioned throughput setting
SSESpecification
(object)
- Server-side encryption settings
StreamSpecification
(object)
- Settings for Streams, including:
StreamEnabled
(boolean), and StreamViewType
(KEYS_ONLY
, NEW_IMAGE
, OLD_IMAGE
, or NEW_AND_OLD_IMAGES
)
TableClass
(string)
- Class of the table, can be set to:
STANDARD
, or STANDARD_INFREQUENT_ACCESS
Tags
(array)
- Array of pairs to label the table
DeleteBackup
Canonical AWS API doc
Properties:
BackupArn
(string) [required]
- ARN of the specified backup
DeleteItem
Canonical AWS API doc
Properties:
TableName
(string) [required]
Key
(object) [required]
- Primary (and sort) key of the item in question
ConditionalOperator
(string)
- Legacy parameter, use
FilterExpression
instead
ConditionExpression
(string)
Expected
(object)
- Legacy parameter, use
ConditionExpression
instead
ExpressionAttributeNames
(object)
ExpressionAttributeValues
(object)
ReturnConsumedCapacity
(string)
- Return throughput consumption in response, can be set to one of:
INDEXES
, TOTAL
, or NONE
ReturnItemCollectionMetrics
(string)
- Return collection metrics in response, can be set to:
SIZE
, or NONE
(default)
ReturnValues
(string)
- Return the item as it was prior to the operation taking place, can be set to
NONE
(default), or ALL_OLD
ReturnValuesOnConditionCheckFailure
(string)
- Return the item attributes that failed a condition check, can be set to
NONE
, or ALL_OLD
DeleteTable
Canonical AWS API doc
Properties:
TableName
(string) [required]
DescribeBackup
Canonical AWS API doc
Properties:
BackupArn
(string) [required]
- ARN of the specified backup
DescribeContinuousBackups
Canonical AWS API doc
Properties:
TableName
(string) [required]
DescribeContributorInsights
Canonical AWS API doc
Properties:
TableName
(string) [required]
IndexName
(string)
- DynamoDB global secondary index name (if applicable)
DescribeEndpoints
Canonical AWS API doc
Properties:
DescribeExport
Canonical AWS API doc
Properties:
ExportArn
(string) [required]
- ARN of the specified export
DescribeGlobalTable
Canonical AWS API doc
Properties:
GlobalTableName
(string) [required]
- DynamoDB global table name
DescribeGlobalTableSettings
Canonical AWS API doc
Properties:
GlobalTableName
(string) [required]
- DynamoDB global table name
DescribeImport
Canonical AWS API doc
Properties:
ImportArn
(string) [required]
- ARN of the specified import
DescribeKinesisStreamingDestination
Canonical AWS API doc
Properties:
TableName
(string) [required]
DescribeLimits
Canonical AWS API doc
Properties:
DescribeTable
Canonical AWS API doc
Properties:
TableName
(string) [required]
DescribeTableReplicaAutoScaling
Canonical AWS API doc
Properties:
TableName
(string) [required]
DescribeTimeToLive
Canonical AWS API doc
Properties:
TableName
(string) [required]
DisableKinesisStreamingDestination
Canonical AWS API doc
Properties:
TableName
(string) [required]
StreamArn
(string) [required]
- ARN of the specified Kinesis data stream
EnableKinesisStreamingDestination
Canonical AWS API doc
Properties:
TableName
(string) [required]
StreamArn
(string) [required]
- ARN of the specified Kinesis data stream
ExecuteStatement
Canonical AWS API doc
Properties:
TableName
(string) [required]
Statement
(string) [required]
- PartiQL statement representing the operation to run
ConsistentRead
(boolean)
- Enable strongly consistent reads; by default eventually consistent reads are used
Limit
(number)
- Maximum number of items to evaluate and return
NextToken
(string)
- Pagination cursor token to be used if
NextToken
was returned in a previous response
Parameters
(array)
- PartiQL statement parameters, if any
ReturnConsumedCapacity
(string)
- Return throughput consumption in response, can be set to one of:
INDEXES
, TOTAL
, or NONE
ReturnValuesOnConditionCheckFailure
(string)
- Return the item attributes that failed a condition check, can be set to
NONE
, or ALL_OLD
ExecuteTransaction
Canonical AWS API doc
Properties:
TableName
(string) [required]
TransactStatements
(array) [required]
- PartiQL statement parameters representing the transaction to run
ClientRequestToken
(string)
- Pagination cursor token to be used if
NextToken
was returned in a previous response
ReturnConsumedCapacity
(string)
- Return throughput consumption in response, can be set to one of:
INDEXES
, TOTAL
, or NONE
ExportTableToPointInTime
Canonical AWS API doc
Properties:
S3Bucket
(string) [required]
- Destination S3 bucket of the snapshot export
TableArn
(string) [required]
- ARN of the table being exported
ClientToken
(string)
- Ensures operation request is idempotent
ExportFormat
(string)
- Format for the exported data, can be set to:
DYNAMODB_JSON
, or IO
ExportTime
(number)
- Point in time (in epoch seconds) from which to export table data
S3BucketOwner
(string)
- AWS account ID that owns the destination S3 bucket
S3Prefix
(string)
- S3 bucket prefix to use as the file name and path of the exported snapshot
S3SseAlgorithm
(string)
- Type of encryption used on the bucket where export data will be stored, can be set to
AES256
, or KMS
S3SseKmsKeyId
(string)
- AWS KMS managed key ID used to encrypt the destination S3 bucket (if applicable)
GetItem
Canonical AWS API doc
Properties:
TableName
(string) [required]
Key
(object) [required]
- Primary (and sort) key of the item in question
AttributesToGet
(array)
- Legacy parameter, use
ProjectionExpression
instead
ConsistentRead
(boolean)
- Enable strongly consistent reads; by default eventually consistent reads are used
ExpressionAttributeNames
(object)
ProjectionExpression
(string)
- Comma separated string that identifies one or more attributes to retrieve from the table
ReturnConsumedCapacity
(string)
- Return throughput consumption in response, can be set to one of:
INDEXES
, TOTAL
, or NONE
ImportTable
Canonical AWS API doc
Properties:
InputFormat
(string) [required]
- Source data format, can be set to:
CSV
, DYNAMODB_JSON
, or ION
S3BucketSource
(object) [required]
- Destination S3 bucket of the snapshot import
TableCreationParameters
(object) [required]
ClientToken
(string)
- Ensures operation request is idempotent
InputCompressionType
(string)
- Input compression type, can be set to:
GZIP
, ZSTD
, or NONE
InputFormatOptions
(object)
- Additional input formatting options
ListBackups
Canonical AWS API doc
Properties:
BackupType
(string)
- Limit backups by type, can be set to:
USER
SYSTEM
, AWS_BACKUP
, or ALL
ExclusiveStartBackupArn
(string)
- Pagination cursor token ARN to be used if
LastEvaluatedBackupArn
was returned in a previous response
Limit
(number)
- Maximum number of items to evaluate and return
TableName
(string)
- List backups by DynamoDB table name
TimeRangeLowerBound
(number)
- Inclusively return backups created after this time
TimeRangeUpperBound
(number)
- Exclusively return backups created before this time
paginate
(boolean, string)
- Enable automatic result pagination; use this instead of making your own individual pagination requests
ListContributorInsights
Canonical AWS API doc
Properties:
MaxResults
(number)
- Maximum number of items to evaluate and return
NextToken
(string)
- Pagination cursor token to be used if
NextToken
was returned in a previous response
TableName
(string)
ListExports
Canonical AWS API doc
Properties:
MaxResults
(number)
- Maximum number of items to evaluate and return
NextToken
(string)
- Pagination cursor token to be used if
NextToken
was returned in a previous response
TableArn
(string)
- ARN of the exported table
ListGlobalTables
Canonical AWS API doc
Properties:
ExclusiveStartGlobalTableName
(string)
- Pagination cursor token to be used if
LastEvaluatedGlobalTableName
was returned in a previous response
Limit
(number)
- Maximum number of items to evaluate and return
RegionName
(string)
- List the global tables in a specific region
ListImports
Canonical AWS API doc
Properties:
NextToken
(string)
- Pagination cursor token to be used if
NextToken
was returned in a previous response
PageSize
(number)
- Maximum number of items to evaluate and return
TableArn
(string)
- ARN of the table imported to
ListTables
Canonical AWS API doc
Properties:
ExclusiveStartTableName
(string)
- Pagination cursor token to be used if
LastEvaluatedTableName
was returned in a previous response
Limit
(number)
- Maximum number of items to evaluate and return
ListTagsOfResource
Canonical AWS API doc
Properties:
NextToken
(string)
- Pagination cursor token to be used if
NextToken
was returned in a previous response
ResourceArn
(string) [required]
- Resource tags to be returned
PutItem
Canonical AWS API doc
Properties:
TableName
(string) [required]
Item
(object) [required]
- Item to be written to DynamoDB
ConditionalOperator
(string)
- Legacy parameter, use
FilterExpression
instead
ConditionExpression
(string)
Expected
(object)
- Legacy parameter, use
ConditionExpression
instead
ExpressionAttributeNames
(object)
ExpressionAttributeValues
(object)
ReturnConsumedCapacity
(string)
- Return throughput consumption in response, can be set to one of:
INDEXES
, TOTAL
, or NONE
ReturnItemCollectionMetrics
(string)
- Return collection metrics in response, can be set to:
SIZE
, or NONE
(default)
ReturnValues
(string)
- Return the item as it was prior to the operation taking place, can be set to
NONE
(default), or ALL_OLD
ReturnValuesOnConditionCheckFailure
(string)
- Return the item attributes that failed a condition check, can be set to
NONE
, or ALL_OLD
Query
Canonical AWS API doc
Properties:
TableName
(string) [required]
AttributesToGet
(array)
- Legacy parameter, use
ProjectionExpression
instead
ConditionalOperator
(string)
- Legacy parameter, use
FilterExpression
instead
ConsistentRead
(boolean)
- Enable strongly consistent reads; by default eventually consistent reads are used
ExclusiveStartKey
(object)
- Pagination cursor token ARN to be used if
LastEvaluatedKey
was returned in a previous response
ExpressionAttributeNames
(object)
ExpressionAttributeValues
(object)
FilterExpression
(string)
IndexName
(string)
- DynamoDB global secondary index name (if applicable)
KeyConditionExpression
(string)
- Condition specifying the key values for items to be retrieved; the condition must perform an equality test on a single partition key value
- More details (AWS)
KeyConditions
(object)
- Legacy parameter, use
KeyConditionExpression
instead
Limit
(number)
- Maximum number of items to evaluate and return
ProjectionExpression
(string)
- Comma separated string that identifies one or more attributes to retrieve from the table
QueryFilter
(object)
- Legacy parameter, use
FilterExpression
instead
ReturnConsumedCapacity
(string)
- Return throughput consumption in response, can be set to one of:
INDEXES
, TOTAL
, or NONE
ScanIndexForward
(boolean)
- Index traversal order:
true
(default) for ascending, false
for descending order
Select
(string)
- Attributes to be returned in the result, can be set to:
ALL_ATTRIBUTES
, ALL_PROJECTED_ATTRIBUTES
, COUNT
, or SPECIFIC_ATTRIBUTES
- More details (AWS)
paginate
(boolean, string)
- Enable automatic result pagination; use this instead of making your own individual pagination requests
RestoreTableFromBackup
Canonical AWS API doc
Properties:
BackupArn
(string) [required]
- ARN of the specified backup
TargetTableName
(string) [required]
- Name of the new table into which the backup will be restored
BillingModeOverride
(string)
- Set how the table is charged for read/write throughput:
PROVISIONED
, or PAY_PER_REQUEST
GlobalSecondaryIndexOverride
(array)
- List of global secondary indexes for the restored table; included indexes should match existing secondary indexes, although indexes can be excluded
LocalSecondaryIndexOverride
(array)
- List of local secondary indexes for the restored table; included indexes should match existing secondary indexes, although indexes can be excluded
ProvisionedThroughputOverride
(object)
- Provisioned throughput setting
SSESpecificationOverride
(object)
- Server-side encryption settings
RestoreTableToPointInTime
Canonical AWS API doc
Properties:
TargetTableName
(string) [required]
- Name of the new table into which the backup will be restored
BillingModeOverride
(string)
- Set how the table is charged for read/write throughput:
PROVISIONED
, or PAY_PER_REQUEST
GlobalSecondaryIndexOverride
(array)
- List of global secondary indexes for the restored table; included indexes should match existing secondary indexes, although indexes can be excluded
LocalSecondaryIndexOverride
(array)
- List of local secondary indexes for the restored table; included indexes should match existing secondary indexes, although indexes can be excluded
ProvisionedThroughputOverride
(object)
- Provisioned throughput setting
RestoreDateTime
(number)
- Past time to restore the table to
SourceTableArn
(string)
- ARN of the specified backup
SourceTableName
(string)
- Name of the source table being restored
SSESpecificationOverride
(object)
- Server-side encryption settings
UseLatestRestorableTime
(boolean)
- Restore to the latest possible time; typically 5 minutes before the current time
Scan
Canonical AWS API doc
Properties:
TableName
(string) [required]
AttributesToGet
(array)
- Legacy parameter, use
ProjectionExpression
instead
ConditionalOperator
(string)
- Legacy parameter, use
FilterExpression
instead
ConsistentRead
(boolean)
- Enable strongly consistent reads; by default eventually consistent reads are used
ExclusiveStartKey
(object)
- Pagination cursor token ARN to be used if
LastEvaluatedKey
was returned in a previous response
ExpressionAttributeNames
(object)
ExpressionAttributeValues
(object)
FilterExpression
(string)
IndexName
(string)
- DynamoDB global secondary index name (if applicable)
Limit
(number)
- Maximum number of items to evaluate and return
ProjectionExpression
(string)
- Comma separated string that identifies one or more attributes to retrieve from the table
ReturnConsumedCapacity
(string)
- Return throughput consumption in response, can be set to one of:
INDEXES
, TOTAL
, or NONE
ScanFilter
(object)
- Legacy parameter, use
FilterExpression
instead
Segment
(number)
Select
(string)
- Attributes to be returned in the result, can be set to:
ALL_ATTRIBUTES
, ALL_PROJECTED_ATTRIBUTES
, COUNT
, or SPECIFIC_ATTRIBUTES
- More details (AWS)
TotalSegments
(number)
paginate
(boolean, string)
- Enable automatic result pagination; use this instead of making your own individual pagination requests
TagResource
Canonical AWS API doc
Properties:
ResourceArn
(string) [required]
Tags
(array) [required]
TransactGetItems
Canonical AWS API doc
Properties:
TransactItems
(array) [required]
- Ordered array of up to 100
TransactGetItem
objects, each of which containing a Get
object - More details (AWS)
ReturnConsumedCapacity
(string)
- Return throughput consumption in response, can be set to one of:
INDEXES
, TOTAL
, or NONE
TransactWriteItems
Canonical AWS API doc
Properties:
TransactItems
(array) [required]
- Ordered array of up to 100
TransactWriteItem
objects, each of which containing a ConditionCheck
, Put
, Update
, or Delete
object - More details (AWS)
ClientRequestToken
(string)
- Ensures operation request is idempotent
ReturnConsumedCapacity
(string)
- Return throughput consumption in response, can be set to one of:
INDEXES
, TOTAL
, or NONE
ReturnItemCollectionMetrics
(string)
- Return collection metrics in response, can be set to:
SIZE
, or NONE
(default)
UntagResource
Canonical AWS API doc
Properties:
ResourceArn
(string) [required]
- Resource to remove tags from
TagKeys
(array) [required]
UpdateContinuousBackups
Canonical AWS API doc
Properties:
TableName
(string) [required]
PointInTimeRecoverySpecification
(object)
UpdateContributorInsights
Canonical AWS API doc
Properties:
TableName
(string) [required]
ContributorInsightsAction
(string)
- Contributor insights action, can be set to:
ENABLE
or DISABLE
IndexName
(string)
- DynamoDB global secondary index name (if applicable)
UpdateGlobalTable
Canonical AWS API doc
Properties:
GlobalTableName
(string) [required]
- DynamoDB global table name
ReplicaUpdates
(array)
- List of regions to be added or removed from the global table
UpdateGlobalTableSettings
Canonical AWS API doc
Properties:
GlobalTableName
(string) [required]
- DynamoDB global table name
GlobalTableBillingMode
(string)
- Set how the table is charged for read/write throughput:
PROVISIONED
, or PAY_PER_REQUEST
GlobalTableGlobalSecondaryIndexSettingsUpdate
(array)
GlobalTableProvisionedWriteCapacityAutoScalingSettingsUpdate
(object)
GlobalTableProvisionedWriteCapacityUnits
(number)
- Maximum number of writes per second before returning a
ThrottlingException
ReplicaSettingsUpdate
(array)
UpdateItem
Canonical AWS API doc
Properties:
Key
(object) [required]
- Primary (and sort) key of the item in question
TableName
(string) [required]
AttributeUpdates
(object)
- Legacy parameter, use
UpdateExpression
instead
ConditionalOperator
(string)
- Legacy parameter, use
ConditionExpression
instead
ConditionExpression
(string)
Expected
(object)
- Legacy parameter, use
ConditionExpression
instead
ExpressionAttributeNames
(object)
ExpressionAttributeValues
(object)
ReturnConsumedCapacity
(string)
- Return throughput consumption in response, can be set to one of:
INDEXES
, TOTAL
, or NONE
ReturnItemCollectionMetrics
(string)
- Return collection metrics in response, can be set to:
SIZE
, or NONE
(default)
ReturnValues
(string)
- Return the item as it was prior to the operation taking place, can be set to
NONE
(default), ALL_OLD
, UPDATED_OLD
, ALL_NEW
, UPDATED_NEW
ReturnValuesOnConditionCheckFailure
(string)
- Return the item attributes that failed a condition check, can be set to
NONE
, or ALL_OLD
UpdateExpression
(string)
- Expression that defines attributes to be updated, the action to be performed on each, and their new values
- More details (AWS)
UpdateTable
Canonical AWS API doc
Properties:
TableName
(string) [required]
AttributeDefinitions
(array)
- Array of attributes that describe the primary (and sort) schema for the table
BillingMode
(string)
- Set how the table is charged for read/write throughput:
PROVISIONED
, or PAY_PER_REQUEST
DeletionProtectionEnabled
(boolean)
- Enable or disable deletion protection
GlobalSecondaryIndexUpdates
(array)
- Global secondary index updates, each of which may be:
Create
, Update
, or Delete
- More details (AWS)
ProvisionedThroughput
(object)
- Provisioned throughput setting
ReplicaUpdates
(array)
SSESpecification
(object)
- Server-side encryption settings
StreamSpecification
(object)
- Settings for Streams, including:
StreamEnabled
(boolean), and StreamViewType
(KEYS_ONLY
, NEW_IMAGE
, OLD_IMAGE
, or NEW_AND_OLD_IMAGES
)
TableClass
(string)
- Class of the table, can be set to:
STANDARD
, or STANDARD_INFREQUENT_ACCESS
UpdateTableReplicaAutoScaling
Canonical AWS API doc
Properties:
TableName
(string) [required]
GlobalSecondaryIndexUpdates
(array)
ProvisionedWriteCapacityAutoScalingUpdate
(object)
ReplicaUpdates
(array)
UpdateTimeToLive
Canonical AWS API doc
Properties:
TableName
(string) [required]
TimeToLiveSpecification
(object)
- TTL settings for the specified table
Usage
This plugin covers all DynamoDB methods (listed & linked below), utilizing DynamoDB's semantics.
By default, with the exception of certain legacy properties (noted below), this plugin will automatically (de)serialize AWS-flavored JSON in requests and responses, so you do not have to treat that as a concern.
Legacy properties (which DynamoDB discourages the use of) that will not be automatically (de)serialized: DeleteItem.Expected
, PutItem.Expected
, Query.KeyConditions
, Query.QueryFilter
, Scan.ScanFilter
, UpdateItem.Expected
Example
import awsLite from '@aws-lite/client'
const aws = await awsLite()
await aws.dynamodb.PutItem({
TableName: 'your-table-name',
Item: { id: 'hello', ts: new Date().toISOString() }
})
DynamoDB methods
Learn more