AWS::Serverless::SimpleTable - AWS Serverless Application Model

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

AWS::Serverless::SimpleTable

建立具有單一屬性主索引鍵的 DynamoDB 資料表。當只需要透過主索引鍵存取資料時,此功能非常有用。

如需更進階的功能,請使用 中的 AWS::DynamoDB::Table 資源 CloudFormation。這些資源可用於 AWS SAM。它們是全方位的,並提供進一步的自訂,包括 key schemaresource policy 自訂。

注意

當您部署到 時 AWS CloudFormation, 會將您的 AWS SAM 資源 AWS SAM 轉換為 CloudFormation 資源。如需詳細資訊,請參閱產生的 CloudFormation 資源 AWS SAM

語法

若要在 AWS Serverless Application Model (AWS SAM) 範本中宣告此實體,請使用下列語法。

屬性

PointInTimeRecoverySpecification

用於啟用時間點復原恢復的設定。

類型PointInTimeRecoverySpecification

必要:否

CloudFormation 相容性:此屬性會直接傳遞至 AWS::DynamoDB::Table 資源的 PointInTimeRecoverySpecification 屬性。

PrimaryKey

要用作資料表主索引鍵的屬性名稱和類型。如果未提供,主索引鍵將是值String為 的 id

注意

建立此資源後,無法修改此屬性的值。

類型PrimaryKeyObject

必要:否

CloudFormation 相容性:此屬性對 是唯一的 AWS SAM ,並且沒有 CloudFormation 同等的。

ProvisionedThroughput

讀取和寫入輸送量佈建資訊。

如果ProvisionedThroughput未指定 ,BillingMode則會指定為 PAY_PER_REQUEST

類型ProvisionedThroughputObject

必要:否

CloudFormation 相容性:此屬性會直接傳遞至 AWS::DynamoDB::Table 資源的 ProvisionedThroughput 屬性。

SSESpecification

指定此屬性來啟用伺服器端加密。

類型SSESpecification

必要:否

CloudFormation 相容性:此屬性會直接傳遞至 AWS::DynamoDB::Table 資源的 SSESpecification 屬性。

TableName

DynamoDB 資料表的名稱。

類型:字串

必要:否

CloudFormation 相容性:此屬性會直接傳遞至 AWS::DynamoDB::Table 資源的 TableName 屬性。

Tags

映射 (字串到字串),指定要新增至此 SimpleTable 的標籤。如需標籤有效金鑰和值的詳細資訊,請參閱AWS CloudFormation 《 使用者指南》中的資源標籤

類型:映射

必要:否

CloudFormation 相容性:此屬性類似於 AWS::DynamoDB::Table 資源的 Tags 屬性。SAM 中的標籤屬性包含 Key:Value 對;在 CloudFormation 中包含標籤物件清單。

傳回值

Ref

當將此資源的邏輯 ID 提供給 Ref 內部函數時,它會傳回基礎 DynamoDB 資料表的資源名稱。

如需使用 Ref函數的詳細資訊,請參閱AWS CloudFormation 《 使用者指南Ref》中的 。

範例

SimpleTableExample

SimpleTable 的範例

YAML

Properties: TableName: my-table PrimaryKey: Name: MyPrimaryKey Type: String ProvisionedThroughput: ReadCapacityUnits: 5 WriteCapacityUnits: 5 Tags: Department: Engineering AppType: Serverless