- Newest
- Most votes
- Most comments
Hi, CloudFormation allows to define same fields that you point to with the link https://docs.aws.amazon.com/timestream/latest/developerguide/API_CreateTable.html
Look at https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-timestream-table-partitionkey.html You'll find exact same fields here.
Best,
Didier
After some digging and thinking about what Didier said I figured out how to solve this. Ultimately, the problem is not only that CDK itself doesn't support this but neither do the underlying Cloudformation libraries. In other words, you can't use even an L1 construct because the property doesn't exist in CfnTableProps yet. My guess is that it will soon (it's not very difficult) but it will take some time for this to roll up into a release.
However, this seems to work. Use an L1 construct to create your table:
let table = new timestream.CfnTable(stack,
ID.TSDB_ALARMS_TABLE_ID,
{
databaseName: ID.TSDB_DB_NAME,
tableName: ID.TSDB_ALARMS_TABLE_NAME,
// the properties below are optional
magneticStoreWriteProperties: {
"EnableMagneticStoreWrites": true,
"MagneticStoreRejectedDataLocation": {
"S3Configuration": {
"BucketName": ID.S3_TSDB_REJECT_BUCKET_NAME,
"ObjectKeyPrefix": "alarm_",
EncryptionOption: "SSE_S3"
}
},
},
retentionProperties: {
"MemoryStoreRetentionPeriodInHours": "24",
"MagneticStoreRetentionPeriodInDays": "36525" /* 100 years */
},
tags: [],
});
then, do this to it:
table.addPropertyOverride("Schema", {
"CompositePartitionKey": [
{"Name": "pk", "Type": "DIMENSION", EnforcementInRecord: "REQUIRED"}
]
});
I think this is the short term solution: use addPropertyOverride()
and you don't have to mess around with a dangerous escape hatch where you have to directly muck around with the DOM nodes.
Leaving this here on repost just in case someone else has the same question.
Relevant content
- asked 2 years ago
- asked 6 months ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 3 months ago
What about from CDK? https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_timestream.CfnTable.html What I suspect is that there's a way to put this into cfnProperties but that takes a string in, so maybe you do:
?
My question was related to CDK, as I indicated in the topic. Take a look at https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_timestream.CfnTableProps.html .... I think that this gives you no way to modify these parameters.