interface CfnTableProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.DynamoDB.CfnTableProps |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsdynamodb#CfnTableProps |
Java | software.amazon.awscdk.services.dynamodb.CfnTableProps |
Python | aws_cdk.aws_dynamodb.CfnTableProps |
TypeScript | aws-cdk-lib » aws_dynamodb » CfnTableProps |
Properties for defining a CfnTable
.
See also: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_dynamodb as dynamodb } from 'aws-cdk-lib';
declare const policyDocument: any;
const cfnTableProps: dynamodb.CfnTableProps = {
keySchema: [{
attributeName: 'attributeName',
keyType: 'keyType',
}],
// the properties below are optional
attributeDefinitions: [{
attributeName: 'attributeName',
attributeType: 'attributeType',
}],
billingMode: 'billingMode',
contributorInsightsSpecification: {
enabled: false,
},
deletionProtectionEnabled: false,
globalSecondaryIndexes: [{
indexName: 'indexName',
keySchema: [{
attributeName: 'attributeName',
keyType: 'keyType',
}],
projection: {
nonKeyAttributes: ['nonKeyAttributes'],
projectionType: 'projectionType',
},
// the properties below are optional
contributorInsightsSpecification: {
enabled: false,
},
onDemandThroughput: {
maxReadRequestUnits: 123,
maxWriteRequestUnits: 123,
},
provisionedThroughput: {
readCapacityUnits: 123,
writeCapacityUnits: 123,
},
warmThroughput: {
readUnitsPerSecond: 123,
writeUnitsPerSecond: 123,
},
}],
importSourceSpecification: {
inputFormat: 'inputFormat',
s3BucketSource: {
s3Bucket: 's3Bucket',
// the properties below are optional
s3BucketOwner: 's3BucketOwner',
s3KeyPrefix: 's3KeyPrefix',
},
// the properties below are optional
inputCompressionType: 'inputCompressionType',
inputFormatOptions: {
csv: {
delimiter: 'delimiter',
headerList: ['headerList'],
},
},
},
kinesisStreamSpecification: {
streamArn: 'streamArn',
// the properties below are optional
approximateCreationDateTimePrecision: 'approximateCreationDateTimePrecision',
},
localSecondaryIndexes: [{
indexName: 'indexName',
keySchema: [{
attributeName: 'attributeName',
keyType: 'keyType',
}],
projection: {
nonKeyAttributes: ['nonKeyAttributes'],
projectionType: 'projectionType',
},
}],
onDemandThroughput: {
maxReadRequestUnits: 123,
maxWriteRequestUnits: 123,
},
pointInTimeRecoverySpecification: {
pointInTimeRecoveryEnabled: false,
},
provisionedThroughput: {
readCapacityUnits: 123,
writeCapacityUnits: 123,
},
resourcePolicy: {
policyDocument: policyDocument,
},
sseSpecification: {
sseEnabled: false,
// the properties below are optional
kmsMasterKeyId: 'kmsMasterKeyId',
sseType: 'sseType',
},
streamSpecification: {
streamViewType: 'streamViewType',
// the properties below are optional
resourcePolicy: {
policyDocument: policyDocument,
},
},
tableClass: 'tableClass',
tableName: 'tableName',
tags: [{
key: 'key',
value: 'value',
}],
timeToLiveSpecification: {
enabled: false,
// the properties below are optional
attributeName: 'attributeName',
},
warmThroughput: {
readUnitsPerSecond: 123,
writeUnitsPerSecond: 123,
},
};
Properties
Name | Type | Description |
---|---|---|
key | IResolvable | IResolvable | Key [] | Specifies the attributes that make up the primary key for the table. |
attribute | IResolvable | IResolvable | Attribute [] | A list of attributes that describe the key schema for the table and indexes. |
billing | string | Specify how you are charged for read and write throughput and how you manage capacity. |
contributor | IResolvable | Contributor | The settings used to enable or disable CloudWatch Contributor Insights for the specified table. |
deletion | boolean | IResolvable | Determines if a table is protected from deletion. |
global | IResolvable | IResolvable | Global [] | Global secondary indexes to be created on the table. You can create up to 20 global secondary indexes. |
import | IResolvable | Import | Specifies the properties of data being imported from the S3 bucket source to the" table. |
kinesis | IResolvable | Kinesis | The Kinesis Data Streams configuration for the specified table. |
local | IResolvable | IResolvable | Local [] | Local secondary indexes to be created on the table. |
on | IResolvable | On | Sets the maximum number of read and write units for the specified on-demand table. |
point | IResolvable | Point | The settings used to enable point in time recovery. |
provisioned | IResolvable | Provisioned | Throughput for the specified table, which consists of values for ReadCapacityUnits and WriteCapacityUnits . |
resource | IResolvable | Resource | A resource-based policy document that contains permissions to add to the specified table. |
sse | IResolvable | SSESpecification | Specifies the settings to enable server-side encryption. |
stream | IResolvable | Stream | The settings for the DynamoDB table stream, which capture changes to items stored in the table. |
table | string | The table class of the new table. |
table | string | A name for the table. |
tags? | Cfn [] | An array of key-value pairs to apply to this resource. |
time | IResolvable | Time | Specifies the Time to Live (TTL) settings for the table. |
warm | IResolvable | Warm | Represents the warm throughput (in read units per second and write units per second) for creating a table. |
keySchema
Type:
IResolvable
|
IResolvable
|
Key
[]
Specifies the attributes that make up the primary key for the table.
The attributes in the KeySchema
property must also be defined in the AttributeDefinitions
property.
attributeDefinitions?
Type:
IResolvable
|
IResolvable
|
Attribute
[]
(optional)
A list of attributes that describe the key schema for the table and indexes.
This property is required to create a DynamoDB table.
Update requires: Some interruptions . Replacement if you edit an existing AttributeDefinition.
billingMode?
Type:
string
(optional)
Specify how you are charged for read and write throughput and how you manage capacity.
Valid values include:
PROVISIONED
- We recommend usingPROVISIONED
for predictable workloads.PROVISIONED
sets the billing mode to Provisioned Mode .PAY_PER_REQUEST
- We recommend usingPAY_PER_REQUEST
for unpredictable workloads.PAY_PER_REQUEST
sets the billing mode to On-Demand Mode .
If not specified, the default is PROVISIONED
.
contributorInsightsSpecification?
Type:
IResolvable
|
Contributor
(optional)
The settings used to enable or disable CloudWatch Contributor Insights for the specified table.
deletionProtectionEnabled?
Type:
boolean |
IResolvable
(optional)
Determines if a table is protected from deletion.
When enabled, the table cannot be deleted by any user or process. This setting is disabled by default. For more information, see Using deletion protection in the Amazon DynamoDB Developer Guide .
globalSecondaryIndexes?
Type:
IResolvable
|
IResolvable
|
Global
[]
(optional)
Global secondary indexes to be created on the table. You can create up to 20 global secondary indexes.
If you update a table to include a new global secondary index, AWS CloudFormation initiates the index creation and then proceeds with the stack update. AWS CloudFormation doesn't wait for the index to complete creation because the backfilling phase can take a long time, depending on the size of the table. You can't use the index or update the table until the index's status is
ACTIVE
. You can track its status by using the DynamoDB DescribeTable command.If you add or delete an index during an update, we recommend that you don't update any other resources. If your stack fails to update and is rolled back while adding a new index, you must manually delete the index.
Updates are not supported. The following are exceptions:
- If you update either the contributor insights specification or the provisioned throughput values of global secondary indexes, you can update the table without interruption.
- You can delete or add one global secondary index without interruption. If you do both in the same update (for example, by changing the index's logical ID), the update fails.
importSourceSpecification?
Type:
IResolvable
|
Import
(optional)
Specifies the properties of data being imported from the S3 bucket source to the" table.
If you specify the
ImportSourceSpecification
property, and also specify either theStreamSpecification
, theTableClass
property, theDeletionProtectionEnabled
property, or theWarmThroughput
property, the IAM entity creating/updating stack must haveUpdateTable
permission.
kinesisStreamSpecification?
Type:
IResolvable
|
Kinesis
(optional)
The Kinesis Data Streams configuration for the specified table.
localSecondaryIndexes?
Type:
IResolvable
|
IResolvable
|
Local
[]
(optional)
Local secondary indexes to be created on the table.
You can create up to 5 local secondary indexes. Each index is scoped to a given hash key value. The size of each hash key can be up to 10 gigabytes.
onDemandThroughput?
Type:
IResolvable
|
On
(optional)
Sets the maximum number of read and write units for the specified on-demand table.
If you use this property, you must specify MaxReadRequestUnits
, MaxWriteRequestUnits
, or both.
pointInTimeRecoverySpecification?
Type:
IResolvable
|
Point
(optional)
The settings used to enable point in time recovery.
provisionedThroughput?
Type:
IResolvable
|
Provisioned
(optional)
Throughput for the specified table, which consists of values for ReadCapacityUnits
and WriteCapacityUnits
.
For more information about the contents of a provisioned throughput structure, see Amazon DynamoDB Table ProvisionedThroughput .
If you set BillingMode
as PROVISIONED
, you must specify this property. If you set BillingMode
as PAY_PER_REQUEST
, you cannot specify this property.
resourcePolicy?
Type:
IResolvable
|
Resource
(optional)
A resource-based policy document that contains permissions to add to the specified table.
In a CloudFormation template, you can provide the policy in JSON or YAML format because CloudFormation converts YAML to JSON before submitting it to DynamoDB . For more information about resource-based policies, see Using resource-based policies for DynamoDB and Resource-based policy examples .
When you attach a resource-based policy while creating a table, the policy creation is strongly consistent . For information about the considerations that you should keep in mind while attaching a resource-based policy, see Resource-based policy considerations .
sseSpecification?
Type:
IResolvable
|
SSESpecification
(optional)
Specifies the settings to enable server-side encryption.
streamSpecification?
Type:
IResolvable
|
Stream
(optional)
The settings for the DynamoDB table stream, which capture changes to items stored in the table.
tableClass?
Type:
string
(optional)
The table class of the new table.
Valid values are STANDARD
and STANDARD_INFREQUENT_ACCESS
.
tableName?
Type:
string
(optional)
A name for the table.
If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the table name. For more information, see Name Type .
If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.
tags?
Type:
Cfn
[]
(optional)
An array of key-value pairs to apply to this resource.
For more information, see Tag .
timeToLiveSpecification?
Type:
IResolvable
|
Time
(optional)
Specifies the Time to Live (TTL) settings for the table.
For detailed information about the limits in DynamoDB, see Limits in Amazon DynamoDB in the Amazon DynamoDB Developer Guide.
warmThroughput?
Type:
IResolvable
|
Warm
(optional)
Represents the warm throughput (in read units per second and write units per second) for creating a table.