AWS::Serverless::SimpleTable
Creates a DynamoDB table with a single attribute primary key. It is useful when data only needs to be accessed via a primary key.
For more advanced features, use an AWS::DynamoDB::Table resource in CloudFormation. These resouces can be used in AWS SAM. They are comprehensive and provide further customization, including key schema and resource policy customization.
Note
When you deploy to AWS CloudFormation, AWS SAM transforms your AWS SAM resources into CloudFormation resources. For more information, see Generated CloudFormation resources for AWS SAM.
Syntax
To declare this entity in your AWS Serverless Application Model (AWS SAM) template, use the following syntax.
YAML
Type: AWS::Serverless::SimpleTable Properties: PointInTimeRecoverySpecification:PointInTimeRecoverySpecificationPrimaryKey:PrimaryKeyObjectProvisionedThroughput:ProvisionedThroughputObjectSSESpecification:SSESpecificationTableName:StringTags:Map
Properties
-
PointInTimeRecoverySpecification -
The settings used to enable point in time recovery.
Type: PointInTimeRecoverySpecification
Required: No
CloudFormation compatibility: This property is passed directly to the
PointInTimeRecoverySpecificationproperty of anAWS::DynamoDB::Tableresource. -
PrimaryKey -
Attribute name and type to be used as the table's primary key. If not provided, the primary key will be a
Stringwith a value ofid.Note
The value of this property cannot be modified after this resource is created.
Type: PrimaryKeyObject
Required: No
CloudFormation compatibility: This property is unique to AWS SAM and doesn't have an CloudFormation equivalent.
-
ProvisionedThroughput -
Read and write throughput provisioning information.
If
ProvisionedThroughputis not specifiedBillingModewill be specified asPAY_PER_REQUEST.Type: ProvisionedThroughputObject
Required: No
CloudFormation compatibility: This property is passed directly to the
ProvisionedThroughputproperty of anAWS::DynamoDB::Tableresource. -
SSESpecification -
Specifies the settings to enable server-side encryption.
Type: SSESpecification
Required: No
CloudFormation compatibility: This property is passed directly to the
SSESpecificationproperty of anAWS::DynamoDB::Tableresource. -
TableName -
Name for the DynamoDB Table.
Type: String
Required: No
CloudFormation compatibility: This property is passed directly to the
TableNameproperty of anAWS::DynamoDB::Tableresource. -
A map (string to string) that specifies the tags to be added to this SimpleTable. For details about valid keys and values for tags, see Resource tag in the AWS CloudFormation User Guide.
Type: Map
Required: No
CloudFormation compatibility: This property is similar to the
Tagsproperty of anAWS::DynamoDB::Tableresource. The Tags property in SAM consists of Key:Value pairs; in CloudFormation it consists of a list of Tag objects.
Return Values
Ref
When the logical ID of this resource is provided to the Ref intrinsic function, it returns the resource name of the underlying DynamoDB table.
For more information about using the Ref function, see Ref in the AWS CloudFormation User Guide.
Examples
SimpleTableExample
Example of a SimpleTable
YAML
Properties: TableName: my-table PrimaryKey: Name: MyPrimaryKey Type: String ProvisionedThroughput: ReadCapacityUnits:5WriteCapacityUnits:5Tags: Department: Engineering AppType: Serverless