Project: KICS (Provisioning / Security & Compliance)
File: c333e906-8d8b-4275-b999-78b6318f8dc6.md

title: DynamoDB With Not Recommented Table Billing Mode hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: c333e906-8d8b-4275-b999-78b6318f8dc6 Query name: DynamoDB With Not Recommented Table Billing Mode Platform: CloudFormation Severity: <span style="color:#edd57e">Low</span> Category: Build Process URL: Checks if DynamoDB Table Billing Mode is set to either PAYPERREQUEST or PROVISIONED<br> ```yaml title="Positive test num. 1 - yaml file" hl_lines="13" AWSTemplateFormatVersion: "2010-09-09" Resources: myDynamoDBTable: Type: AWS::DynamoDB::Table Properties: AttributeDefinitions: AttributeName: "Album" AttributeType: "S" AttributeName: "Artist" AttributeType: "S" BillingMode: "PayPal" KeySchema: AttributeName: "Album" KeyType: "HASH" AttributeName: "Artist" KeyType: "RANGE" TableName: "myTableName" ``` ```json title="Positive test num. 2 - json file" hl_lines="16" { "Resources": { "myDynamoDBTable": { "Type": "AWS::DynamoDB::Table", "Properties": { "AttributeDefinitions": [ { "AttributeName": "Album", "AttributeType": "S" }, { "AttributeName": "Artist", "AttributeType": "S" } ], "BillingMode": "PayPal", "KeySchema": [ { "AttributeName": "Album", "KeyType": "HASH" }, { "AttributeName": "Artist", "KeyType": "RANGE" } ], "TableName": "myTableName" } } }, "AWSTemplateFormatVersion": "2010-09-09" } ``` ```yaml title="Negative test num. 1 - yaml file" AWSTemplateFormatVersion: "2010-09-09" Resources: myDynamoDBTable: Type: AWS::DynamoDB::Table Properties: AttributeDefinitions: AttributeName: "Album" AttributeType: "S" AttributeName: "Artist" AttributeType: "S" KeySchema: AttributeName: "Album" KeyType: "HASH" AttributeName: "Artist" KeyType: "RANGE" ProvisionedThroughput: ReadCapacityUnits: "5" WriteCapacityUnits: "5" TableName: "myTableName" myDynamoDBTable2: Type: AWS::DynamoDB::Table Properties: AttributeDefinitions: AttributeName: "Album" AttributeType: "S" AttributeName: "Artist" AttributeType: "S" BillingMode: "PAYPERREQUEST" KeySchema: AttributeName: "Album" KeyType: "HASH" AttributeName: "Artist" KeyType: "RANGE" TableName: "myTableName" myDynamoDBTable3: Type: AWS::DynamoDB::Table Properties: AttributeDefinitions: AttributeName: "Album" AttributeType: "S" AttributeName: "Artist" AttributeType: "S" BillingMode: "PROVISIONED" KeySchema: AttributeName: "Album" KeyType: "HASH" AttributeName: "Artist" KeyType: "RANGE" ProvisionedThroughput: ReadCapacityUnits: "5" WriteCapacityUnits: "5" TableName: "myTableName" ``` ```json title="Negative test num. 2 - json file" { "AWSTemplateFormatVersion": "2010-09-09", "Resources": { "myDynamoDBTable": { "Type": "AWS::DynamoDB::Table", "Properties": { "TableName": "myTableName", "AttributeDefinitions": [ { "AttributeName": "Album", "AttributeType": "S" }, { "AttributeType": "S", "AttributeName": "Artist" } ], "KeySchema": [ { "AttributeName": "Album", "KeyType": "HASH" }, { "AttributeName": "Artist", "KeyType": "RANGE" } ], "ProvisionedThroughput": { "ReadCapacityUnits": "5", "WriteCapacityUnits": "5" } } }, "myDynamoDBTable2": { "Type": "AWS::DynamoDB::Table", "Properties": { "TableName": "myTableName", "AttributeDefinitions": [ { "AttributeType": "S", "AttributeName": "Album" }, { "AttributeName": "Artist", "AttributeType": "S" } ], "BillingMode": "PAYPERREQUEST", "KeySchema": [ { "AttributeName": "Album", "KeyType": "HASH" }, { "AttributeName": "Artist", "KeyType": "RANGE" } ] } }, "myDynamoDBTable3": { "Type": "AWS::DynamoDB::Table", "Properties": { "AttributeDefinitions": [ { "AttributeName": "Album", "AttributeType": "S" }, { "AttributeName": "Artist", "AttributeType": "S" } ], "BillingMode": "PROVISIONED", "KeySchema": [ { "KeyType": "HASH", "AttributeName": "Album" }, { "AttributeName": "Artist", "KeyType": "RANGE" } ], "ProvisionedThroughput": { "ReadCapacityUnits": "5", "WriteCapacityUnits": "5" }, "TableName": "myTableName" } } } } ```