'put_item in DDB Global Table uploads to wrong region
I created a Lambda function in the eu-west-3 region to put some data from one table to another.
I use boto3 and I'm trying to put items from one DDB table in eu-west-3 region to another Global Table in eu-west-3 region.
However, I can see that the Global Table in eu-west-3 has size - 0 bytes and the Global Table in us-west-2 has the size of 9kb. Does it mean that the items are currently in us-west-2 instead of eu-west-3?
I also understand that those should be replicated across all regions, but I'd still like to write to the correct region.
GlobalTable has replicas in 3 regions ['eu-west-3', 'us-west-2', 'ap-southeast-1']
Is it possible to change it and actually put items to the eu-west-3?
existing_region = 'eu-west-3'
global_table = boto3.resource('dynamodb',
region_name=existing_region
).Table('GlobalTableName')
print("Updating table with data...")
with global_table.batch_writer() as batch:
for item in table_items:
batch.put_item(Item=item)
Solution 1:[1]
You're showing us only part of the code that's writing to the table, but I suspect, your problem is another one anyway:
However, I can see that the Global Table in eu-west-3 has size - 0 bytes and the Global Table in us-west-2 has the size of 9kb.
The size of a DynamoDB table you can see is not computed in real-time and is updated roughly every six hours.
Check the items in the table, most likely they are where they should be, otherwise we need to see more code.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Maurice |

