databases
Creates, updates, deletes or gets a database resource or lists databases in a region
Overview
| Name | databases |
| Type | Resource |
| Description | The AWS::Timestream::Database resource creates a Timestream database. |
| Id | awscc.timestream.databases |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
arn | string | |
database_name | string | The name for the database. If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the database name. |
kms_key_id | string | The KMS key for the database. If the KMS key is not specified, the database will be encrypted with a Timestream managed KMS key located in your account. |
tags | array | An array of key-value pairs to apply to this resource. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
database_name | string | The name for the database. If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the database name. |
region | string | AWS region. |
For more information, see AWS::Timestream::Database.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | databases | INSERT | region |
delete_resource | databases | DELETE | Identifier, region |
update_resource | databases | UPDATE | Identifier, PatchDocument, region |
list_resources | databases_list_only | SELECT | region |
get_resource | databases | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual database.
SELECT
region,
arn,
database_name,
kms_key_id,
tags
FROM awscc.timestream.databases
WHERE
region = '{{ region }}' AND
Identifier = '{{ database_name }}';
Lists all databases in a region.
SELECT
region,
database_name
FROM awscc.timestream.databases_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new database resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.timestream.databases (
DatabaseName,
KmsKeyId,
Tags,
region
)
SELECT
'{{ database_name }}',
'{{ kms_key_id }}',
'{{ tags }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.timestream.databases (
DatabaseName,
KmsKeyId,
Tags,
region
)
SELECT
'{{ database_name }}',
'{{ kms_key_id }}',
'{{ 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: database
props:
- name: database_name
value: '{{ database_name }}'
- name: kms_key_id
value: '{{ kms_key_id }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
UPDATE example
Use the following StackQL query and manifest file to update a database resource, using stack-deploy.
/*+ update */
UPDATE awscc.timestream.databases
SET PatchDocument = string('{{ {
"KmsKeyId": kms_key_id,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ database_name }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.timestream.databases
WHERE
Identifier = '{{ database_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 databases resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
timestream:CreateDatabase,
timestream:DescribeEndpoints,
timestream:TagResource,
kms:CreateGrant,
kms:DescribeKey,
kms:Decrypt
timestream:DescribeDatabase,
timestream:DescribeEndpoints,
timestream:ListTagsForResource
timestream:UpdateDatabase,
timestream:DescribeDatabase,
timestream:DescribeEndpoints,
timestream:TagResource,
timestream:UntagResource
timestream:DeleteDatabase,
timestream:DescribeEndpoints
timestream:ListDatabases,
timestream:DescribeEndpoints