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
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@
],

],
'ProvisionedThroughput' => [
'ReadCapacityUnits' => 10,
'WriteCapacityUnits' => 10
]
'BillingMode' => 'PAY_PER_REQUEST' // Use on-demand billing mode.
];

try {
Expand Down
38 changes: 4 additions & 34 deletions php/example_code/dynamodb/Tables_CRUD.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,10 @@
'KeySchema' => [
[
'AttributeName' => 'Id',
'KeyType' => 'HASH' //Partition key
'KeyType' => 'HASH' //Partition key.
]
],
'ProvisionedThroughput' => [
'ReadCapacityUnits' => 5,
'WriteCapacityUnits' => 6
]
'BillingMode' => 'PAY_PER_REQUEST' // Use on-demand billing mode.
]);

$dynamodb->waitUntil('TableExists', [
Expand All @@ -60,36 +57,9 @@
####################################################################
# Updating the table

echo "# Updating the provisioned throughput of table $tableName.\n";
try {
$response = $dynamodb->updateTable([
'TableName' => $tableName,
'ProvisionedThroughput' => [
'ReadCapacityUnits' => 6,
'WriteCapacityUnits' => 7
]
]);

$dynamodb->waitUntil('TableExists', [
'TableName' => $tableName,
'@waiter' => [
'delay' => 5,
'maxAttempts' => 20
]
]);
// No need to update provisioned throughput as we are using PAY_PER_REQUEST mode.

echo "New provisioned throughput settings:\n";

$response = $dynamodb->describeTable(['TableName' => $tableName]);

echo "Read capacity units: " .
$response['Table']['ProvisionedThroughput']['ReadCapacityUnits'] . "\n";
echo "Write capacity units: " .
$response['Table']['ProvisionedThroughput']['WriteCapacityUnits'] . "\n";
} catch (DynamoDbException $e) {
echo $e->getMessage() . "\n";
exit("Unable to update table $tableName\n");
}
echo "# Skipping table update for throughput settings (not needed for PAY_PER_REQUEST).\n";

####################################################################
# Deleting the table
Expand Down