- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
ImportTableCommand
Imports table data from an S3 bucket.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { DynamoDBClient, ImportTableCommand } from "@aws-sdk/client-dynamodb"; // ES Modules import
// const { DynamoDBClient, ImportTableCommand } = require("@aws-sdk/client-dynamodb"); // CommonJS import
const client = new DynamoDBClient(config);
const input = { // ImportTableInput
ClientToken: "STRING_VALUE",
S3BucketSource: { // S3BucketSource
S3BucketOwner: "STRING_VALUE",
S3Bucket: "STRING_VALUE", // required
S3KeyPrefix: "STRING_VALUE",
},
InputFormat: "DYNAMODB_JSON" || "ION" || "CSV", // required
InputFormatOptions: { // InputFormatOptions
Csv: { // CsvOptions
Delimiter: "STRING_VALUE",
HeaderList: [ // CsvHeaderList
"STRING_VALUE",
],
},
},
InputCompressionType: "GZIP" || "ZSTD" || "NONE",
TableCreationParameters: { // TableCreationParameters
TableName: "STRING_VALUE", // required
AttributeDefinitions: [ // AttributeDefinitions // required
{ // AttributeDefinition
AttributeName: "STRING_VALUE", // required
AttributeType: "S" || "N" || "B", // required
},
],
KeySchema: [ // KeySchema // required
{ // KeySchemaElement
AttributeName: "STRING_VALUE", // required
KeyType: "HASH" || "RANGE", // required
},
],
BillingMode: "PROVISIONED" || "PAY_PER_REQUEST",
ProvisionedThroughput: { // ProvisionedThroughput
ReadCapacityUnits: Number("long"), // required
WriteCapacityUnits: Number("long"), // required
},
OnDemandThroughput: { // OnDemandThroughput
MaxReadRequestUnits: Number("long"),
MaxWriteRequestUnits: Number("long"),
},
SSESpecification: { // SSESpecification
Enabled: true || false,
SSEType: "AES256" || "KMS",
KMSMasterKeyId: "STRING_VALUE",
},
GlobalSecondaryIndexes: [ // GlobalSecondaryIndexList
{ // GlobalSecondaryIndex
IndexName: "STRING_VALUE", // required
KeySchema: [ // required
{
AttributeName: "STRING_VALUE", // required
KeyType: "HASH" || "RANGE", // required
},
],
Projection: { // Projection
ProjectionType: "ALL" || "KEYS_ONLY" || "INCLUDE",
NonKeyAttributes: [ // NonKeyAttributeNameList
"STRING_VALUE",
],
},
ProvisionedThroughput: {
ReadCapacityUnits: Number("long"), // required
WriteCapacityUnits: Number("long"), // required
},
OnDemandThroughput: {
MaxReadRequestUnits: Number("long"),
MaxWriteRequestUnits: Number("long"),
},
WarmThroughput: { // WarmThroughput
ReadUnitsPerSecond: Number("long"),
WriteUnitsPerSecond: Number("long"),
},
},
],
},
};
const command = new ImportTableCommand(input);
const response = await client.send(command);
// { // ImportTableOutput
// ImportTableDescription: { // ImportTableDescription
// ImportArn: "STRING_VALUE",
// ImportStatus: "IN_PROGRESS" || "COMPLETED" || "CANCELLING" || "CANCELLED" || "FAILED",
// TableArn: "STRING_VALUE",
// TableId: "STRING_VALUE",
// ClientToken: "STRING_VALUE",
// S3BucketSource: { // S3BucketSource
// S3BucketOwner: "STRING_VALUE",
// S3Bucket: "STRING_VALUE", // required
// S3KeyPrefix: "STRING_VALUE",
// },
// ErrorCount: Number("long"),
// CloudWatchLogGroupArn: "STRING_VALUE",
// InputFormat: "DYNAMODB_JSON" || "ION" || "CSV",
// InputFormatOptions: { // InputFormatOptions
// Csv: { // CsvOptions
// Delimiter: "STRING_VALUE",
// HeaderList: [ // CsvHeaderList
// "STRING_VALUE",
// ],
// },
// },
// InputCompressionType: "GZIP" || "ZSTD" || "NONE",
// TableCreationParameters: { // TableCreationParameters
// TableName: "STRING_VALUE", // required
// AttributeDefinitions: [ // AttributeDefinitions // required
// { // AttributeDefinition
// AttributeName: "STRING_VALUE", // required
// AttributeType: "S" || "N" || "B", // required
// },
// ],
// KeySchema: [ // KeySchema // required
// { // KeySchemaElement
// AttributeName: "STRING_VALUE", // required
// KeyType: "HASH" || "RANGE", // required
// },
// ],
// BillingMode: "PROVISIONED" || "PAY_PER_REQUEST",
// ProvisionedThroughput: { // ProvisionedThroughput
// ReadCapacityUnits: Number("long"), // required
// WriteCapacityUnits: Number("long"), // required
// },
// OnDemandThroughput: { // OnDemandThroughput
// MaxReadRequestUnits: Number("long"),
// MaxWriteRequestUnits: Number("long"),
// },
// SSESpecification: { // SSESpecification
// Enabled: true || false,
// SSEType: "AES256" || "KMS",
// KMSMasterKeyId: "STRING_VALUE",
// },
// GlobalSecondaryIndexes: [ // GlobalSecondaryIndexList
// { // GlobalSecondaryIndex
// IndexName: "STRING_VALUE", // required
// KeySchema: [ // required
// {
// AttributeName: "STRING_VALUE", // required
// KeyType: "HASH" || "RANGE", // required
// },
// ],
// Projection: { // Projection
// ProjectionType: "ALL" || "KEYS_ONLY" || "INCLUDE",
// NonKeyAttributes: [ // NonKeyAttributeNameList
// "STRING_VALUE",
// ],
// },
// ProvisionedThroughput: {
// ReadCapacityUnits: Number("long"), // required
// WriteCapacityUnits: Number("long"), // required
// },
// OnDemandThroughput: {
// MaxReadRequestUnits: Number("long"),
// MaxWriteRequestUnits: Number("long"),
// },
// WarmThroughput: { // WarmThroughput
// ReadUnitsPerSecond: Number("long"),
// WriteUnitsPerSecond: Number("long"),
// },
// },
// ],
// },
// StartTime: new Date("TIMESTAMP"),
// EndTime: new Date("TIMESTAMP"),
// ProcessedSizeBytes: Number("long"),
// ProcessedItemCount: Number("long"),
// ImportedItemCount: Number("long"),
// FailureCode: "STRING_VALUE",
// FailureMessage: "STRING_VALUE",
// },
// };
ImportTableCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
InputFormat Required | InputFormat | undefined | The format of the source data. Valid values for |
S3BucketSource Required | S3BucketSource | undefined | The S3 bucket that provides the source for the import. |
TableCreationParameters Required | TableCreationParameters | undefined | Parameters for the table to import the data into. |
ClientToken | string | undefined | Providing a A client token is valid for 8 hours after the first request that uses it is completed. After 8 hours, any request with the same client token is treated as a new request. Do not resubmit the same request with the same client token for more than 8 hours, or the result might not be idempotent. If you submit a request with the same client token but a change in other parameters within the 8-hour idempotency window, DynamoDB returns an |
InputCompressionType | InputCompressionType | undefined | Type of compression to be used on the input coming from the imported table. |
InputFormatOptions | InputFormatOptions | undefined | Additional properties that specify how the input is formatted, |
ImportTableCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
ImportTableDescription Required | ImportTableDescription | undefined | Represents the properties of the table created for the import, and parameters of the import. The import parameters include import status, how many items were processed, and how many errors were encountered. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
ImportConflictException | client | There was a conflict when importing from the specified S3 source. This can occur when the current import conflicts with a previous import request that had the same client token. |
LimitExceededException | client | There is no limit to the number of daily on-demand backups that can be taken. For most purposes, up to 500 simultaneous table operations are allowed per account. These operations include When you are creating a table with one or more secondary indexes, you can have up to 250 such requests running at a time. However, if the table or index specifications are complex, then DynamoDB might temporarily reduce the number of concurrent operations. When importing into DynamoDB, up to 50 simultaneous import table operations are allowed per account. There is a soft account quota of 2,500 tables. GetRecords was called with a value of more than 1000 for the limit request parameter. More than 2 processes are reading from the same streams shard at the same time. Exceeding this limit may result in request throttling. |
ResourceInUseException | client | The operation conflicts with the resource's availability. For example:
When appropriate, wait for the ongoing update to complete and attempt the request again. |
DynamoDBServiceException | Base exception class for all service exceptions from DynamoDB service. |