Skip to content

Commit 0df50f1

Browse files
committed
switch to on-demand dynamodb
1 parent 382cf16 commit 0df50f1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

aws_sra_examples/solutions/genai/bedrock_org/lambda/src/sra_dynamodb.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
if TYPE_CHECKING:
2323
from mypy_boto3_dynamodb.client import DynamoDBClient
2424
from mypy_boto3_dynamodb.service_resource import DynamoDBServiceResource
25-
from mypy_boto3_dynamodb.type_defs import AttributeDefinitionTypeDef, KeySchemaElementTypeDef, ProvisionedThroughputTypeDef
25+
from mypy_boto3_dynamodb.type_defs import AttributeDefinitionTypeDef, KeySchemaElementTypeDef
2626

2727

2828
class SRADynamoDB:
@@ -88,13 +88,15 @@ def create_table(self, table_name: str) -> None:
8888
{"AttributeName": "solution_name", "AttributeType": "S"}, # String type
8989
{"AttributeName": "record_id", "AttributeType": "S"}, # String type
9090
]
91-
provisioned_throughput: ProvisionedThroughputTypeDef = {"ReadCapacityUnits": 5, "WriteCapacityUnits": 5}
9291

9392
# Create table
9493
self.LOGGER.info(f"Creating {table_name} dynamodb table...")
9594
try:
9695
self.DYNAMODB_CLIENT.create_table(
97-
TableName=table_name, KeySchema=key_schema, AttributeDefinitions=attribute_definitions, ProvisionedThroughput=provisioned_throughput
96+
TableName=table_name,
97+
KeySchema=key_schema,
98+
AttributeDefinitions=attribute_definitions,
99+
BillingMode='PAY_PER_REQUEST' # Changed to on-demand capacity mode
98100
)
99101
self.LOGGER.info(f"{table_name} dynamodb table created successfully.")
100102
except Exception as e:

0 commit comments

Comments
 (0)