tables
Creates, updates, deletes or gets a table resource or lists tables in a region
Overview
| Name | tables |
| Type | Resource |
| Description | The AWS::Timestream::Table resource creates a Timestream Table. |
| Id | awscc.timestream.tables |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
arn | string | |
name | string | The table name exposed as a read-only attribute. |
database_name | string | The name for the database which the table to be created belongs to. |
table_name | string | The name for the table. If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the table name. |
retention_properties | object | The retention duration of the memory store and the magnetic store. |
schema | object | A Schema specifies the expected data model of the table. |
magnetic_store_write_properties | object | The properties that determine whether magnetic store writes are enabled. |
tags | array | An array of key-value pairs to apply to this resource. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
name | string | The table name exposed as a read-only attribute. |
database_name | string | The name for the database which the table to be created belongs to. |
table_name | string | The name for the table. If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the table name. |
region | string | AWS region. |
For more information, see AWS::Timestream::Table.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | tables | INSERT | DatabaseName, region |
delete_resource | tables | DELETE | Identifier, region |
update_resource | tables | UPDATE | Identifier, PatchDocument, region |
list_resources | tables_list_only | SELECT | region |
get_resource | tables | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual table.
SELECT
region,
arn,
name,
database_name,
table_name,
retention_properties,
schema,
magnetic_store_write_properties,
tags
FROM awscc.timestream.tables
WHERE
region = '{{ region }}' AND
Identifier = '{{ database_name }}|{{ table_name }}';
Lists all tables in a region.
SELECT
region,
database_name,
table_name
FROM awscc.timestream.tables_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new table resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.timestream.tables (
DatabaseName,
region
)
SELECT
'{{ database_name }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.timestream.tables (
DatabaseName,
TableName,
RetentionProperties,
Schema,
MagneticStoreWriteProperties,
Tags,
region
)
SELECT
'{{ database_name }}',
'{{ table_name }}',
'{{ retention_properties }}',
'{{ schema }}',
'{{ magnetic_store_write_properties }}',
'{{ tags }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: table
props:
- name: database_name
value: '{{ database_name }}'
- name: table_name
value: '{{ table_name }}'
- name: retention_properties
value:
memory_store_retention_period_in_hours: '{{ memory_store_retention_period_in_hours }}'
magnetic_store_retention_period_in_days: '{{ magnetic_store_retention_period_in_days }}'
- name: schema
value:
composite_partition_key:
- type: '{{ type }}'
name: '{{ name }}'
enforcement_in_record: '{{ enforcement_in_record }}'
- name: magnetic_store_write_properties
value:
enable_magnetic_store_writes: '{{ enable_magnetic_store_writes }}'
magnetic_store_rejected_data_location:
s3_configuration:
bucket_name: '{{ bucket_name }}'
object_key_prefix: '{{ object_key_prefix }}'
encryption_option: '{{ encryption_option }}'
kms_key_id: '{{ kms_key_id }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
UPDATE example
Use the following StackQL query and manifest file to update a table resource, using stack-deploy.
/*+ update */
UPDATE awscc.timestream.tables
SET PatchDocument = string('{{ {
"RetentionProperties": retention_properties,
"Schema": schema,
"MagneticStoreWriteProperties": magnetic_store_write_properties,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ database_name }}|{{ table_name }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.timestream.tables
WHERE
Identifier = '{{ database_name }}|{{ table_name }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
Additional Parameters
Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:
| Parameter | Description |
|---|---|
ClientToken | A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. |
RoleArn | The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.If you do not specify a role, a temporary session is created using your AWS user credentials. |
TypeVersionId | For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used. |
Permissions
To operate on the tables resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
timestream:CreateTable,
timestream:DescribeEndpoints,
timestream:TagResource,
s3:PutObject,
s3:GetObject,
s3:GetBucketAcl,
kms:GenerateDataKey,
kms:GenerateDataKeyWithoutPlaintext,
kms:DescribeKey,
kms:Encrypt
timestream:DescribeTable,
timestream:DescribeEndpoints,
timestream:ListTagsForResource
timestream:UpdateTable,
timestream:DescribeEndpoints,
timestream:TagResource,
timestream:UntagResource,
s3:PutObject,
s3:GetObject,
s3:GetBucketAcl,
kms:GenerateDataKey,
kms:GenerateDataKeyWithoutPlaintext,
kms:DescribeKey,
kms:Encrypt
timestream:DeleteTable,
timestream:DescribeEndpoints,
timestream:DescribeTable
timestream:ListTables,
timestream:DescribeEndpoints