workspaces
Creates, updates, deletes, gets or lists a workspaces resource.
Overview
| Name | workspaces |
| Type | Resource |
| Id | aws.amp.workspaces |
Fields
The following fields are returned by SELECT queries:
- describe_workspace
- list_workspaces
| Name | Datatype | Description |
|---|---|---|
alias | string | A user-assigned workspace alias. |
arn | string | The ARN of the workspace. For example, arn:aws:aps:<region>:123456789012:workspace/ws-example1-1234-abcd-5678-ef90abcd1234. (pattern: <code>arn:aws[-a-z]*:aps:[-a-z0-9]+:[0-9]{12}:workspace/.+</code>) |
created_at | string (date-time) | The date and time that the workspace was created. |
kms_key_arn | string | A KMS Key ARN. (pattern: <code>arn:aws[-a-z]*:kms:[-a-z0-9]+:[0-9]{12}:key/[-a-f0-9]+</code>) |
prometheus_endpoint | string | The Prometheus endpoint available for this workspace. For example, https://aps-workspaces.<region>.amazonaws.com/workspaces/ws-example1-1234-abcd-5678-ef90abcd1234/api/v1/. |
status | object | The current status of the workspace. |
tags | object | The list of tag keys and values that are associated with the workspace. |
workspace_id | string | A workspace ID. (pattern: <code>.[0-9A-Za-z][-.0-9A-Z_a-z].*</code>) |
| Name | Datatype | Description |
|---|---|---|
alias | string | A user-assigned workspace alias. |
arn | string | The ARN of the workspace. (pattern: <code>arn:aws[-a-z]*:aps:[-a-z0-9]+:[0-9]{12}:workspace/.+</code>) |
created_at | string (date-time) | The date and time that the workspace was created. |
kms_key_arn | string | A KMS Key ARN. (pattern: <code>arn:aws[-a-z]*:kms:[-a-z0-9]+:[0-9]{12}:key/[-a-f0-9]+</code>) |
status | object | The current status of the workspace. |
tags | object | The list of tag keys and values that are associated with the workspace. |
workspace_id | string | A workspace ID. (pattern: <code>.[0-9A-Za-z][-.0-9A-Z_a-z].*</code>) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_workspace | select | workspace_id, region | Returns information about an existing workspace. | |
list_workspaces | select | region | nextToken, alias, maxResults | Lists all of the Amazon Managed Service for Prometheus workspaces in your account. This includes workspaces being created or deleted. |
create_workspace | insert | region | Creates a Prometheus workspace. A workspace is a logical space dedicated to the storage and querying of Prometheus metrics. You can have one or more workspaces in each Region in your account. | |
update_workspace_alias | update | workspace_id, region | Updates the alias of an existing workspace. | |
delete_workspace | delete | workspace_id, region | clientToken | Deletes an existing workspace. When you delete a workspace, the data that has been ingested into it is not immediately deleted. It will be permanently deleted within one month. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
workspace_id | string | The ID of the workspace to delete. |
alias | string | If this is included, it filters the results to only the workspaces with names that start with the value that you specify here. Amazon Managed Service for Prometheus will automatically strip any blank spaces from the beginning and end of the alias that you specify. |
clientToken | string | A unique identifier that you can provide to ensure the idempotency of the request. Case-sensitive. |
maxResults | integer | The maximum number of workspaces to return per request. The default is 100. |
nextToken | string | The token for the next set of items to return. You receive this token from a previous call, and use it to get the next page of results. The other parameters must be the same as the initial call. For example, if your initial request has maxResults of 10, and there are 12 workspaces to return, then your initial request will return 10 and a nextToken. Using the next token in a subsequent call will return the remaining 2 workspaces. |
SELECT examples
- describe_workspace
- list_workspaces
Returns information about an existing workspace.
SELECT
alias,
arn,
created_at,
kms_key_arn,
prometheus_endpoint,
status,
tags,
workspace_id
FROM aws.amp.workspaces
WHERE workspace_id = '{{ workspace_id }}' -- required
AND region = '{{ region }}' -- required
;
Lists all of the Amazon Managed Service for Prometheus workspaces in your account. This includes workspaces being created or deleted.
SELECT
alias,
arn,
created_at,
kms_key_arn,
status,
tags,
workspace_id
FROM aws.amp.workspaces
WHERE region = '{{ region }}' -- required
AND nextToken = '{{ nextToken }}'
AND alias = '{{ alias }}'
AND maxResults = '{{ maxResults }}'
;
INSERT examples
- create_workspace
- Manifest
Creates a Prometheus workspace. A workspace is a logical space dedicated to the storage and querying of Prometheus metrics. You can have one or more workspaces in each Region in your account.
INSERT INTO aws.amp.workspaces (
alias,
clientToken,
tags,
kmsKeyArn,
region
)
SELECT
'{{ alias }}',
'{{ clientToken }}',
'{{ tags }}',
'{{ kmsKeyArn }}',
'{{ region }}'
RETURNING
arn,
kms_key_arn,
status,
tags,
workspace_id
;
# Description fields are for documentation purposes
- name: workspaces
props:
- name: region
value: "{{ region }}"
description: Required parameter for the workspaces resource.
- name: alias
value: "{{ alias }}"
description: |
A user-assigned workspace alias.
- name: clientToken
value: "{{ clientToken }}"
description: |
An identifier used to ensure the idempotency of a write request.
- name: tags
value: "{{ tags }}"
description: |
A tag associated with a resource.
- name: kmsKeyArn
value: "{{ kmsKeyArn }}"
description: |
A KMS Key ARN.
UPDATE examples
- update_workspace_alias
Updates the alias of an existing workspace.
UPDATE aws.amp.workspaces
SET
alias = '{{ alias }}',
clientToken = '{{ clientToken }}'
WHERE
workspace_id = '{{ workspace_id }}' --required
AND region = '{{ region }}' --required;
DELETE examples
- delete_workspace
Deletes an existing workspace. When you delete a workspace, the data that has been ingested into it is not immediately deleted. It will be permanently deleted within one month.
DELETE FROM aws.amp.workspaces
WHERE workspace_id = '{{ workspace_id }}' --required
AND region = '{{ region }}' --required
AND clientToken = '{{ clientToken }}'
;