AWSのリファレンスを読みながら作成したのに、少しハマったので・・
最初に書いたコード
- 実行してもDynamoDBが作成されません
yaml
---
AWSTemplateFormatVersion: 2010-09-09
Description: DynamoDB Crete
Parameters:
TableName:
Type: String
Description: DDB Table Name
Resources:
DDBTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: !Ref TableName
AttributeDefinitions:
-
AttributeName: CreatedId
AttributeType: S
KeySchema:
-
AttributeName: CreatedId
KeyType: HASH
Outputs:
DynamoDBTableName:
Value:
!Ref DDBTable
Description: DynamoDB Table Name
よく読んだら、デフォルトで入る値によって、必須となるパラメータがあった
正しいコード
- うまくいった
yaml
---
AWSTemplateFormatVersion: 2010-09-09
Description: DynamoDB Crete
Parameters:
TableName:
Type: String
Description: DDB Table Name
Resources:
DDBTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: !Ref TableName
AttributeDefinitions:
-
AttributeName: CreatedId
AttributeType: S
KeySchema:
-
AttributeName: CreatedId
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 3
WriteCapacityUnits: 3
Outputs:
DynamoDBTableName:
Value:
!Ref DDBTable
Description: DynamoDB Table Name