EnsureSharedPrometheusInstance

Updated at:

Retrieves or creates a shared Prometheus instance for a workspace.

Operation description

Retrieves or creates a shared Prometheus instance for a workspace. If the instance does not exist, it is created. If it already exists, the existing instance is returned. Currently, only shareScope=Workspace is supported. A workspace corresponds to only one shared instance in the requested region, and the instance name is generated by the server. The caller identity is the user. If the workspace does not exist, a 404 error is returned.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

cms:EnsureSharedPrometheusInstance

none

*PrometheusInstance

acs:cms:{#regionId}:{#accountId}:prometheusinstance/*

None None

Request syntax

POST /shared-prometheus-instances HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

body

object

No

The request parameters for retrieving or creating a shared Prometheus instance.

shareScope

string

Yes

The share scope. Currently, only Workspace is supported, which indicates the shared Prometheus instance for the workspace in the requested region. Workspaces in the same region share the same instance, and no additional instances are created. Policy and Environment are not currently supported.

Valid values:

  • Workspace

Workspace

workspace

string

Yes

The name of the workspace. If the workspace does not exist, a 404 error is returned.

team-workspace

aliyunLang

string

No

The language of the returned information. Valid values:

  • zh: Chinese.

  • en: English. Default value: zh.

zh

Response elements

Element

Type

Description

Example

object

The details of the shared Prometheus instance, and whether a new instance was created by this call.

prometheusInstance

object

The details of the shared Prometheus instance. The fields are the same as the prometheusInstance field in GetPrometheusInstance.

accessType

string

The access permissions of the instance. Valid values: readWrite, readOnly, and httpReadOnly.

readWrite

archiveDuration

integer

The number of days to automatically archive and retain data after the storage expires. A value of 0 indicates no archiving, and 3650 indicates permanent retention.

0

authFreeReadPolicy

string

The IP address whitelist policy that allows access to the authentication-free read endpoint.

127.0.0.1

authFreeWritePolicy

string

The IP address whitelist policy that allows access to the authentication-free write endpoint.

127.0.0.1

authToken

string

The authentication token of the instance.

example-auth-token

createTime

string

The time when the instance was created. The time is displayed in UTC+0 in the yyyy-MM-ddTHH:mmZ format.

2026-11-11T06:00Z

enableAuthFreeRead

boolean

Specifies whether authentication-free read is enabled.

false

enableAuthFreeWrite

boolean

Specifies whether authentication-free write is enabled.

false

enableAuthToken

boolean

Specifies whether authentication token-based authentication is enabled.

false

extraInfo

object

The extended information. This field is returned only for console requests.

{"slsProject":"proj-cms-cn-hangzhou"}

string

The value of the extended information.

proj-cms-cn-hangzhou

httpApiInterUrl

string

The public endpoint of the Prometheus HTTP API.

https://cn-hangzhou.arms.aliyuncs.com/prometheus/rw-example/api/v1

httpApiIntraUrl

string

The internal network endpoint of the Prometheus HTTP API.

https://cn-hangzhou-intranet.arms.aliyuncs.com/prometheus/rw-example/api/v1

httpApiInternalUrl

string

The internal endpoint of the Prometheus HTTP API.

http://prometheus.cn-hangzhou.aliyuncs.com/prometheus/rw-example/api/v1

instanceType

string

The instance type. For shared instances, the value is remote-write, which indicates Prometheus for Remote Write.

remote-write

paymentType

string

The billing method. A value of POSTPAY indicates pay-as-you-go based on the number of reported metrics, and POSTPAY_GB indicates pay-as-you-go based on the volume of written metrics.

POSTPAY_GB

product

string

The product to which the instance belongs. Valid values: arms and cms.

cms

prometheusInstanceId

string

The ID of the Prometheus instance.

rw-8f3c1a2b4d5e6f70

prometheusInstanceName

string

The name of the Prometheus instance. For workspace shared instances, the name is generated by the server in the RegionShare:{workspace}:{regionId} format.

RegionShare:team-workspace:cn-hangzhou

pushGatewayInterUrl

string

The public endpoint of Pushgateway.

https://cn-hangzhou.arms.aliyuncs.com/prometheus/rw-example/api/v1/pushgateway

pushGatewayIntraUrl

string

The internal network endpoint of Pushgateway.

https://cn-hangzhou-intranet.arms.aliyuncs.com/prometheus/rw-example/api/v1/pushgateway

pushGatewayInternalUrl

string

The internal endpoint of Pushgateway.

http://prometheus.cn-hangzhou.aliyuncs.com/prometheus/rw-example/api/v1/pushgateway

regionId

string

The ID of the region where the instance resides.

cn-hangzhou

remoteReadInterUrl

string

The public endpoint of Remote Read.

https://cn-hangzhou.arms.aliyuncs.com/prometheus/rw-example/api/v1/read

remoteReadIntraUrl

string

The internal network endpoint of Remote Read.

https://cn-hangzhou-intranet.arms.aliyuncs.com/prometheus/rw-example/api/v1/read

remoteReadInternalUrl

string

The internal endpoint of Remote Read.

http://prometheus.cn-hangzhou.aliyuncs.com/prometheus/rw-example/api/v1/read

remoteWriteInterUrl

string

The public endpoint of Remote Write.

https://cn-hangzhou.arms.aliyuncs.com/prometheus/rw-example/api/v1/write

remoteWriteIntraUrl

string

The internal network endpoint of Remote Write.

https://cn-hangzhou-intranet.arms.aliyuncs.com/prometheus/rw-example/api/v1/write

remoteWriteInternalUrl

string

The internal endpoint of Remote Write.

http://prometheus.cn-hangzhou.aliyuncs.com/prometheus/rw-example/api/v1/write

resourceGroupId

string

The ID of the resource group to which the instance belongs.

rg-acfmyexample

resourceType

string

The resource type. The value is fixed as PrometheusInstance.

PrometheusInstance

status

string

The backend data storage status, such as Running.

Running

storageDuration

integer

The metric storage duration in days.

90

supportAuthTypes

array

The list of authentication and authorization types supported by the instance.

["BasicAuth"]

string

An authentication and authorization type supported by the instance. Valid values: BasicAuth, AuthFree, and AuthToken.

Valid values:

  • BasicAuth
  • AuthFree
  • AuthToken

BasicAuth

tags

array<object>

The instance tags. Workspace shared instances include the system tag acs:cms:shareScope.

object

key

string

The key of the instance tag.

acs:cms:shareScope

value

string

The value of the instance tag.

region:cn-hangzhou:team-workspace

userId

string

The ID of the Alibaba Cloud account to which the instance belongs.

1234567890123456

version

string

The version of the instance, such as V2.

V2

workspace

string

The name of the workspace to which the instance belongs.

team-workspace

folderUrl

string

The URL of the visualization dashboard associated with the instance.

https://g.console.aliyun.com/folders/example

grafanaInstanceId

string

The ID of the bound managed Grafana instance.

grafana-cn-hangzhou-example

grafanaInstanceName

string

The name of the bound managed Grafana instance.

shared-grafana

paymentTypeUpdateTime

string

The time when the billing method of the instance was last modified. The time is in UTC+0 and formatted as yyyy-MM-ddTHH:mmZ.

2026-11-11T06:00Z

storeConfig PrometheusInstanceStoreConfig

The query cache and parallel query configurations for Prometheus.

created

boolean

Indicates whether a new instance was created by this call. The value is false if an existing instance is found.

false

requestId

string

The request ID.

A1B2C3D4-E5F6-7890-ABCD-EF1234567890

Examples

Success response

JSON format

{
  "prometheusInstance": {
    "accessType": "readWrite",
    "archiveDuration": 0,
    "authFreeReadPolicy": "127.0.0.1",
    "authFreeWritePolicy": "127.0.0.1",
    "authToken": "example-auth-token",
    "createTime": "2026-11-11T06:00Z",
    "enableAuthFreeRead": false,
    "enableAuthFreeWrite": false,
    "enableAuthToken": false,
    "extraInfo": {
      "key": "proj-cms-cn-hangzhou"
    },
    "httpApiInterUrl": "https://cn-hangzhou.arms.aliyuncs.com/prometheus/rw-example/api/v1",
    "httpApiIntraUrl": "https://cn-hangzhou-intranet.arms.aliyuncs.com/prometheus/rw-example/api/v1",
    "httpApiInternalUrl": "http://prometheus.cn-hangzhou.aliyuncs.com/prometheus/rw-example/api/v1",
    "instanceType": "remote-write",
    "paymentType": "POSTPAY_GB",
    "product": "cms",
    "prometheusInstanceId": "rw-8f3c1a2b4d5e6f70",
    "prometheusInstanceName": "RegionShare:team-workspace:cn-hangzhou",
    "pushGatewayInterUrl": "https://cn-hangzhou.arms.aliyuncs.com/prometheus/rw-example/api/v1/pushgateway",
    "pushGatewayIntraUrl": "https://cn-hangzhou-intranet.arms.aliyuncs.com/prometheus/rw-example/api/v1/pushgateway",
    "pushGatewayInternalUrl": "http://prometheus.cn-hangzhou.aliyuncs.com/prometheus/rw-example/api/v1/pushgateway",
    "regionId": "cn-hangzhou",
    "remoteReadInterUrl": "https://cn-hangzhou.arms.aliyuncs.com/prometheus/rw-example/api/v1/read",
    "remoteReadIntraUrl": "https://cn-hangzhou-intranet.arms.aliyuncs.com/prometheus/rw-example/api/v1/read",
    "remoteReadInternalUrl": "http://prometheus.cn-hangzhou.aliyuncs.com/prometheus/rw-example/api/v1/read",
    "remoteWriteInterUrl": "https://cn-hangzhou.arms.aliyuncs.com/prometheus/rw-example/api/v1/write",
    "remoteWriteIntraUrl": "https://cn-hangzhou-intranet.arms.aliyuncs.com/prometheus/rw-example/api/v1/write",
    "remoteWriteInternalUrl": "http://prometheus.cn-hangzhou.aliyuncs.com/prometheus/rw-example/api/v1/write",
    "resourceGroupId": "rg-acfmyexample",
    "resourceType": "PrometheusInstance",
    "status": "Running",
    "storageDuration": 90,
    "supportAuthTypes": [
      "BasicAuth"
    ],
    "tags": [
      {
        "key": "acs:cms:shareScope",
        "value": "region:cn-hangzhou:team-workspace"
      }
    ],
    "userId": "1234567890123456",
    "version": "V2",
    "workspace": "team-workspace",
    "folderUrl": "https://g.console.aliyun.com/folders/example",
    "grafanaInstanceId": "grafana-cn-hangzhou-example",
    "grafanaInstanceName": "shared-grafana",
    "paymentTypeUpdateTime": "2026-11-11T06:00Z",
    "storeConfig": {
      "queryCacheEnable": false,
      "parallelEnable": false,
      "parallelMode": "static",
      "parallelCountPerHost": 2,
      "totalParallelCount": 8
    }
  },
  "created": false,
  "requestId": "A1B2C3D4-E5F6-7890-ABCD-EF1234567890"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.