1 Answer
- Newest
- Most votes
- Most comments
1
Maybe it's looking for the Timestream endpoint in the wrong region by default. Try passing region_name=us-west-2 in the config parameter when creating a client
--Syd
answered 2 years ago
Working fine now that I added the region_name to the config in client creation, thanks!
Relevant content
- asked 3 years ago
- AWS OFFICIALUpdated 14 days ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 6 months ago
Hi there,
Which boto3 and botocore are you using? Can you try to upgrade them to the latest version? Also Is it possible to post a code snapshot of your Python code and AWS CLI?
I am using v1.24.19 for boto3 and v1.27.19 botocore. I tried upgrading them to the latest version (v1.24.21 and v1.27.21) but I get the same error.
Below is my client creation code. I have used the same code to assume a different role with a different profile for S3 before and it worked fine. session = boto3.Session() roleClient = session.client('sts') assumedRole = roleClient.assume_role(RoleArn=roleARN, RoleSessionName='role') credentials = assumedRole['Credentials'] awsKey = credentials['AccessKeyId'] awsSecretKey = credentials['SecretAccessKey'] awsSessionToken = credentials['SessionToken'] client = boto3.client( 'timestream-write', aws_access_key_id=awsKey, aws_secret_access_key=awsSecretKey, aws_session_token=awsSessionToken, )
For writing it's just the one line of code for testing:
result = self.client.write_records(DatabaseName=self.database, TableName=self.table, Records=records, CommonAttributes={})
I tried setting the database and table names to empty strings and it gives the same error so it's failing before it gets to check those variables. For the AWS CLI, I used the example from the docs:
aws timestream-write create-database --database-name myFirstDatabase