CreateWorkspaceCommand

Creates a workspace. In a workspace, you can create Grafana dashboards and visualizations to analyze your metrics, logs, and traces. You don't have to build, package, or deploy any hardware to run the Grafana server.

Don't use CreateWorkspace to modify an existing workspace. Instead, use UpdateWorkspace .

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { GrafanaClient, CreateWorkspaceCommand } from "@aws-sdk/client-grafana"; // ES Modules import
// const { GrafanaClient, CreateWorkspaceCommand } = require("@aws-sdk/client-grafana"); // CommonJS import
const client = new GrafanaClient(config);
const input = { // CreateWorkspaceRequest
  accountAccessType: "STRING_VALUE", // required
  clientToken: "STRING_VALUE",
  organizationRoleName: "STRING_VALUE",
  permissionType: "STRING_VALUE", // required
  stackSetName: "STRING_VALUE",
  workspaceDataSources: [ // DataSourceTypesList
    "STRING_VALUE",
  ],
  workspaceDescription: "STRING_VALUE",
  workspaceName: "STRING_VALUE",
  workspaceNotificationDestinations: [ // NotificationDestinationsList
    "STRING_VALUE",
  ],
  workspaceOrganizationalUnits: [ // OrganizationalUnitList
    "STRING_VALUE",
  ],
  workspaceRoleArn: "STRING_VALUE",
  authenticationProviders: [ // AuthenticationProviders // required
    "STRING_VALUE",
  ],
  tags: { // TagMap
    "<keys>": "STRING_VALUE",
  },
  vpcConfiguration: { // VpcConfiguration
    securityGroupIds: [ // SecurityGroupIds // required
      "STRING_VALUE",
    ],
    subnetIds: [ // SubnetIds // required
      "STRING_VALUE",
    ],
  },
  configuration: "STRING_VALUE",
  networkAccessControl: { // NetworkAccessConfiguration
    prefixListIds: [ // PrefixListIds // required
      "STRING_VALUE",
    ],
    vpceIds: [ // VpceIds // required
      "STRING_VALUE",
    ],
  },
  grafanaVersion: "STRING_VALUE",
};
const command = new CreateWorkspaceCommand(input);
const response = await client.send(command);
// { // CreateWorkspaceResponse
//   workspace: { // WorkspaceDescription
//     accountAccessType: "STRING_VALUE",
//     created: new Date("TIMESTAMP"), // required
//     dataSources: [ // DataSourceTypesList // required
//       "STRING_VALUE",
//     ],
//     description: "STRING_VALUE",
//     endpoint: "STRING_VALUE", // required
//     grafanaVersion: "STRING_VALUE", // required
//     id: "STRING_VALUE", // required
//     modified: new Date("TIMESTAMP"), // required
//     name: "STRING_VALUE",
//     organizationRoleName: "STRING_VALUE",
//     notificationDestinations: [ // NotificationDestinationsList
//       "STRING_VALUE",
//     ],
//     organizationalUnits: [ // OrganizationalUnitList
//       "STRING_VALUE",
//     ],
//     permissionType: "STRING_VALUE",
//     stackSetName: "STRING_VALUE",
//     status: "STRING_VALUE", // required
//     workspaceRoleArn: "STRING_VALUE",
//     licenseType: "STRING_VALUE",
//     freeTrialConsumed: true || false,
//     licenseExpiration: new Date("TIMESTAMP"),
//     freeTrialExpiration: new Date("TIMESTAMP"),
//     authentication: { // AuthenticationSummary
//       providers: [ // AuthenticationProviders // required
//         "STRING_VALUE",
//       ],
//       samlConfigurationStatus: "STRING_VALUE",
//     },
//     tags: { // TagMap
//       "<keys>": "STRING_VALUE",
//     },
//     vpcConfiguration: { // VpcConfiguration
//       securityGroupIds: [ // SecurityGroupIds // required
//         "STRING_VALUE",
//       ],
//       subnetIds: [ // SubnetIds // required
//         "STRING_VALUE",
//       ],
//     },
//     networkAccessControl: { // NetworkAccessConfiguration
//       prefixListIds: [ // PrefixListIds // required
//         "STRING_VALUE",
//       ],
//       vpceIds: [ // VpceIds // required
//         "STRING_VALUE",
//       ],
//     },
//     grafanaToken: "STRING_VALUE",
//   },
// };

CreateWorkspaceCommand Input

See CreateWorkspaceCommandInput for more details

Parameter
Type
Description
accountAccessType
Required
AccountAccessType | undefined

Specifies whether the workspace can access Amazon Web Services resources in this Amazon Web Services account only, or whether it can also access Amazon Web Services resources in other accounts in the same organization. If you specify ORGANIZATION, you must specify which organizational units the workspace can access in the workspaceOrganizationalUnits parameter.

authenticationProviders
Required
AuthenticationProviderTypes[] | undefined

Specifies whether this workspace uses SAML 2.0, IAM Identity Center, or both to authenticate users for using the Grafana console within a workspace. For more information, see User authentication in Amazon Managed Grafana .

permissionType
Required
PermissionType | undefined

When creating a workspace through the Amazon Web Services API, CLI or Amazon Web Services CloudFormation, you must manage IAM roles and provision the permissions that the workspace needs to use Amazon Web Services data sources and notification channels.

You must also specify a workspaceRoleArn for a role that you will manage for the workspace to use when accessing those datasources and notification channels.

The ability for Amazon Managed Grafana to create and update IAM roles on behalf of the user is supported only in the Amazon Managed Grafana console, where this value may be set to SERVICE_MANAGED.

Use only the CUSTOMER_MANAGED permission type when creating a workspace with the API, CLI or Amazon Web Services CloudFormation.

clientToken
string | undefined

A unique, case-sensitive, user-provided identifier to ensure the idempotency of the request.

configuration
AutomaticJsonStringConversion | string | undefined

The configuration string for the workspace that you create. For more information about the format and configuration options available, see Working in your Grafana workspace .

grafanaVersion
string | undefined

Specifies the version of Grafana to support in the new workspace. If not specified, defaults to the latest version (for example, 10.4).

To get a list of supported versions, use the ListVersions operation.

networkAccessControl
NetworkAccessConfiguration | undefined

Configuration for network access to your workspace.

When this is configured, only listed IP addresses and VPC endpoints will be able to access your workspace. Standard Grafana authentication and authorization will still be required.

If this is not configured, or is removed, then all IP addresses and VPC endpoints will be allowed. Standard Grafana authentication and authorization will still be required.

organizationRoleName
string | undefined

The name of an IAM role that already exists to use with Organizations to access Amazon Web Services data sources and notification channels in other accounts in an organization.

stackSetName
string | undefined

The name of the CloudFormation stack set to use to generate IAM roles to be used for this workspace.

tags
Record<string, string> | undefined

The list of tags associated with the workspace.

vpcConfiguration
VpcConfiguration | undefined

The configuration settings for an Amazon VPC that contains data sources for your Grafana workspace to connect to.

Connecting to a private VPC is not yet available in the Asia Pacific (Seoul) Region (ap-northeast-2).

workspaceDataSources
DataSourceType[] | undefined

This parameter is for internal use only, and should not be used.

workspaceDescription
string | undefined

A description for the workspace. This is used only to help you identify this workspace.

Pattern: ^[\p{L}\p{Z}\p{N}\p{P}]{0,2048}$

workspaceName
string | undefined

The name for the workspace. It does not have to be unique.

workspaceNotificationDestinations
NotificationDestinationType[] | undefined

Specify the Amazon Web Services notification channels that you plan to use in this workspace. Specifying these data sources here enables Amazon Managed Grafana to create IAM roles and permissions that allow Amazon Managed Grafana to use these channels.

workspaceOrganizationalUnits
string[] | undefined

Specifies the organizational units that this workspace is allowed to use data sources from, if this workspace is in an account that is part of an organization.

workspaceRoleArn
string | undefined

Specified the IAM role that grants permissions to the Amazon Web Services resources that the workspace will view data from, including both data sources and notification channels. You are responsible for managing the permissions for this role as new data sources or notification channels are added.

CreateWorkspaceCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
workspace
Required
WorkspaceDescription | undefined

A structure containing data about the workspace that was created.

Throws

Name
Fault
Details
AccessDeniedException
client

You do not have sufficient permissions to perform this action.

ConflictException
client

A resource was in an inconsistent state during an update or a deletion.

InternalServerException
server

Unexpected error while processing the request. Retry the request.

ServiceQuotaExceededException
client

The request would cause a service quota to be exceeded.

ThrottlingException
client

The request was denied because of request throttling. Retry the request.

ValidationException
client

The value of a parameter in the request caused an error.

GrafanaServiceException
Base exception class for all service exceptions from Grafana service.