So I'm trying to write a program that is able to upload data to AWS Timestream, but the problem is that I continue to get "Error: dispatch failure" when trying to upload records. My function is defined as follows:
pub async fn upload() {
let region = Region::new("us-east-1");
let config = SdkConfig::builder().region(region).build();
let client = AWSClient::new(&config);
let common_attributes = Record::builder()
.measure_name("cpu_usage")
.dimensions(Dimension::builder().name("host").value("host1").build())
.build();
let new_record = Record::builder()
.measure_name("cpu_usage")
.measure_value("13.5")
.time(chrono::Utc::now().to_rfc3339())
.dimensions(Dimension::builder().name("host").value("host1").build())
.build();
let _request = client
.write_records()
.database_name("sampleDB")
.table_name("sampleTB")
.common_attributes(common_attributes)
.records(new_record)
.send()
.await
.unwrap_or_else(|e| {
println!("Error: {}", e);
panic!("Error sending data to timestream");
});
}
I am able to get up to the creation of the new_record, but executing client.write_records() returns "Error: dispatch failure". Does anyone know what I should do to make it work? The crates I am using are: aws_config, aws_sdk_timestreamwrite, and aws_types.