Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions samtranslator/model/dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ class DynamoDBTable(Resource):
'GlobalSecondaryIndexes': PropertyType(False, list_of(is_type(dict))),
'KeySchema': PropertyType(False, list_of(is_type(dict))),
'LocalSecondaryIndexes': PropertyType(False, list_of(is_type(dict))),
'ProvisionedThroughput': PropertyType(True, dict_of(is_str(), one_of(is_type(int), is_type(dict)))),
'ProvisionedThroughput': PropertyType(False, dict_of(is_str(), one_of(is_type(int), is_type(dict)))),
'StreamSpecification': PropertyType(False, is_type(dict)),
'TableName': PropertyType(False, one_of(is_str(), is_type(dict))),
'Tags': PropertyType(False, list_of(is_type(dict))),
'SSESpecification': PropertyType(False, is_type(dict))
'SSESpecification': PropertyType(False, is_type(dict)),
'BillingMode': PropertyType(False, is_str())
}

runtime_attrs = {
Expand Down
6 changes: 2 additions & 4 deletions samtranslator/model/sam_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,11 +517,9 @@ def _construct_dynamodb_table(self):
}]

if self.ProvisionedThroughput:
provisioned_throughput = self.ProvisionedThroughput
dynamodb_table.ProvisionedThroughput = self.ProvisionedThroughput
else:
provisioned_throughput = {'ReadCapacityUnits': 5, 'WriteCapacityUnits': 5}

dynamodb_table.ProvisionedThroughput = provisioned_throughput
dynamodb_table.BillingMode = 'PAY_PER_REQUEST'

if self.SSESpecification:
dynamodb_table.SSESpecification = self.SSESpecification
Expand Down
5 changes: 1 addition & 4 deletions tests/translator/output/aws-cn/depends_on.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,7 @@
"MySamTable": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"AttributeDefinitions": [
{
"AttributeName": "id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
"MinimalTable": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"SSESpecification": {
"SSEEnabled": true
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
"MinimalTableWithTags": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"AttributeDefinitions": [
{
"AttributeName": "id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
"Type": "AWS::DynamoDB::Table",
"Properties": {
"TableName": "MySimpleTable",
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"AttributeDefinitions": [
{
"AttributeName": "id",
Expand All @@ -28,10 +25,7 @@
"TableName": {
"Ref": "MySimpleTableParameter"
},
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"AttributeDefinitions": [
{
"AttributeName": "id",
Expand All @@ -52,10 +46,7 @@
"TableName": {
"Fn::Sub": "${AWS::StackName}MySimpleTable"
},
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"AttributeDefinitions": [
{
"AttributeName": "id",
Expand Down
5 changes: 1 addition & 4 deletions tests/translator/output/aws-cn/simpletable.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
"MinimalTable": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"AttributeDefinitions": [
{
"AttributeName": "id",
Expand Down
5 changes: 1 addition & 4 deletions tests/translator/output/aws-cn/simpletable_with_sse.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
"TableWithSSE": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"SSESpecification": {
"SSEEnabled": true
},
Expand Down
5 changes: 1 addition & 4 deletions tests/translator/output/aws-us-gov/depends_on.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,7 @@
"MySamTable": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"AttributeDefinitions": [
{
"AttributeName": "id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
"MinimalTable": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"SSESpecification": {
"SSEEnabled": true
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
"MinimalTableWithTags": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"AttributeDefinitions": [
{
"AttributeName": "id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
"Type": "AWS::DynamoDB::Table",
"Properties": {
"TableName": "MySimpleTable",
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"AttributeDefinitions": [
{
"AttributeName": "id",
Expand All @@ -28,10 +25,7 @@
"TableName": {
"Ref": "MySimpleTableParameter"
},
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"AttributeDefinitions": [
{
"AttributeName": "id",
Expand All @@ -52,10 +46,7 @@
"TableName": {
"Fn::Sub": "${AWS::StackName}MySimpleTable"
},
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"AttributeDefinitions": [
{
"AttributeName": "id",
Expand Down
5 changes: 1 addition & 4 deletions tests/translator/output/aws-us-gov/simpletable.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
"MinimalTable": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"AttributeDefinitions": [
{
"AttributeName": "id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
"TableWithSSE": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"SSESpecification": {
"SSEEnabled": true
},
Expand Down
5 changes: 1 addition & 4 deletions tests/translator/output/depends_on.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,7 @@
"MySamTable": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"AttributeDefinitions": [
{
"AttributeName": "id",
Expand Down
5 changes: 1 addition & 4 deletions tests/translator/output/globals_for_simpletable.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
"MinimalTable": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"SSESpecification": {
"SSEEnabled": true
},
Expand Down
5 changes: 1 addition & 4 deletions tests/translator/output/simple_table_with_extra_tags.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
"MinimalTableWithTags": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"AttributeDefinitions": [
{
"AttributeName": "id",
Expand Down
15 changes: 3 additions & 12 deletions tests/translator/output/simple_table_with_table_name.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
"Type": "AWS::DynamoDB::Table",
"Properties": {
"TableName": "MySimpleTable",
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"AttributeDefinitions": [
{
"AttributeName": "id",
Expand All @@ -28,10 +25,7 @@
"TableName": {
"Ref": "MySimpleTableParameter"
},
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"AttributeDefinitions": [
{
"AttributeName": "id",
Expand All @@ -52,10 +46,7 @@
"TableName": {
"Fn::Sub": "${AWS::StackName}MySimpleTable"
},
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"AttributeDefinitions": [
{
"AttributeName": "id",
Expand Down
5 changes: 1 addition & 4 deletions tests/translator/output/simpletable.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
"MinimalTable": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"AttributeDefinitions": [
{
"AttributeName": "id",
Expand Down
5 changes: 1 addition & 4 deletions tests/translator/output/simpletable_with_sse.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
"TableWithSSE": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"ProvisionedThroughput": {
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"BillingMode": "PAY_PER_REQUEST",
"SSESpecification": {
"SSEEnabled": true
},
Expand Down
2 changes: 1 addition & 1 deletion versions/2016-10-31.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ The `AWS::Serverless::SimpleTable` resource creates a DynamoDB table with a sing
Property Name | Type | Description
---|:---:|---
PrimaryKey | [Primary Key Object](#primary-key-object) | Attribute name and type to be used as the table's primary key. **This cannot be modified without replacing the resource.** Defaults to `String` attribute named ID.
ProvisionedThroughput | [Provisioned Throughput Object](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-provisionedthroughput.html) | Read and write throughput provisioning information. Defaults to 5 read and 5 write capacity units per second.
ProvisionedThroughput | [Provisioned Throughput Object](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-provisionedthroughput.html) | Read and write throughput provisioning information. If ProvisionedThroughput is not specified BillingMode will be specified as PAY_PER_REQUEST
Tags | Map of `string` to `string` | A map (string to string) that specifies the tags to be added to this table. Keys and values are limited to alphanumeric characters.
TableName | `string` | Name for the DynamoDB Table
SSESpecification | [DynamoDB SSESpecification](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-table-ssespecification.html) | Specifies the settings to enable server-side encryption.
Expand Down