Skip to main content

workspaces

Creates, updates, deletes, gets or lists a workspaces resource.

Overview

Nameworkspaces
TypeResource
Idaws.amp.workspaces

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
aliasstringA user-assigned workspace alias.
arnstringThe 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_atstring (date-time)The date and time that the workspace was created.
kms_key_arnstringA KMS Key ARN. (pattern: <code>arn:aws[-a-z]*:kms:[-a-z0-9]+:[0-9]{12}:key/[-a-f0-9]+</code>)
prometheus_endpointstringThe Prometheus endpoint available for this workspace. For example, https:​//aps-workspaces.<region>.amazonaws.com/workspaces/ws-example1-1234-abcd-5678-ef90abcd1234/api/v1/.
statusobjectThe current status of the workspace.
tagsobjectThe list of tag keys and values that are associated with the workspace.
workspace_idstringA workspace ID. (pattern: <code>.[0-9A-Za-z][-.0-9A-Z_a-z].*</code>)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_workspaceselectworkspace_id, regionReturns information about an existing workspace.
list_workspacesselectregionnextToken, alias, maxResultsLists all of the Amazon Managed Service for Prometheus workspaces in your account. This includes workspaces being created or deleted.
create_workspaceinsertregionCreates 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_aliasupdateworkspace_id, regionUpdates the alias of an existing workspace.
delete_workspacedeleteworkspace_id, regionclientTokenDeletes 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.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)
workspace_idstringThe ID of the workspace to delete.
aliasstringIf 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.
clientTokenstringA unique identifier that you can provide to ensure the idempotency of the request. Case-sensitive.
maxResultsintegerThe maximum number of workspaces to return per request. The default is 100.
nextTokenstringThe 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

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
;

INSERT examples

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
;

UPDATE examples

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

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 }}'
;