はじめに
DynamoDBをCloudFormatinで使うときの留意点をまとめてみました
DynamoDBでのBillingMode
BillingモードはPROVISIONED
とPAY_PER_REQUEST
のふた通りあります。
PAY_PER_REQUEST
は従量課金になります。
Billingモードを指定しない場合はデフォルトのPROVISIONED
が選択されます。
PROVISIONED
が指定された場合はProvisionedThroughput
の項目が必須になります。
DynamoDBUserTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5
TableName:
Fn::Sub: "User"
BillingMode
の項目がないためPROVISIONED
が指定され、ProvisionedThroughput
のReadCapacityUnits
とWriteCapacityUnits
を5にしています。
最後に
従量課金はアクセス数が予測できない時に使うと良さそうですが、開発段階では必要なさそうです。
参考文献