Project: StarRocks (App Definition and Development / Database)
File: CREATE_STORAGE_VOLUME.md

displayed_sidebar: "English" Creates a storage volume for a remote storage system. This feature is supported from v3.1. A storage volume consists of the properties and credential information of the remote data storage. You can reference a storage volume when you create databases and cloud-native tables in a . CAUTION Only users with the CREATE STORAGE VOLUME privilege on the SYSTEM level can perform this operation. ```SQL CREATE STORAGE VOLUME [IF NOT EXISTS] <storagevolumename> TYPE = { S3 | AZBLOB } LOCATIONS = ('<remotestoragepath>') [ COMMENT '<comment_string>' ] PROPERTIES ("key" = "value",...) ``` | Parameter | Description | | - | | | storagevolumename | The name of the storage volume. Please note that you cannot create a storage volume named `builtinstoragevolume` because it is used to create the builtin storage volume. For the naming conventions, see .| | TYPE | The type of the remote storage system. Valid values: `S3` and `AZBLOB`. `S3` indicates AWS S3 or S3-compatible storage systems. `AZBLOB` indicates Azure Blob Storage (supported from v3.1.1 onwards). | | LOCATIONS | The storage locations. The format is as follows:<ul><li>For AWS S3 or S3 protocol-compatible storage systems: `s3://<s3path>`. `<s3path>` must be an absolute path, for example, `s3://testbucket/subpath`. Note that if you want to enable the feature for the storage volume, you can only specify the bucket name, and specifying a sub-path is not allowed.</li><li>For Azure Blob Storage: `azblob://<azblobpath>`. `<azblobpath>` must be an absolute path, for example, `azblob://testcontainer/subpath`.</li></ul> | | COMMENT | The comment on the storage volume. | | PROPERTIES | Parameters in the `"key" = "value"` pairs used to specify the properties and credential information to access the remote storage system. For detailed information, see . | The table below lists all available properties of storage volumes. Following the table are the usage instructions of these properties, categorized by different scenarios from the perspectives of and . | Property | Description | | -- | | | enabled | Whether to enable this storage volume. Default: `false`. Disabled storage volume cannot be referenced. | | aws.s3.region | The region in which your S3 bucket resides, for example, `us-west-2`. | | aws.s3.endpoint | The endpoint URL used to access your S3 bucket, for example, `https://s3.us-west-2.amazonaws.com`. From v3.3.0 onwards, the Amazon S3 Express One Zone storage class is supported, for example, `https://s3express.us-west-2.amazonaws.com`. | | aws.s3.useawssdkdefaultbehavior | Whether to use the default authentication credential of AWS SDK. Valid values: `true` and `false` (Default). | |

| Whether to use Instance Profile and Assumed Role as credential methods for accessing S3. Valid values: `true` and `false` (Default).<ul><li>If you use IAM user-based credential (Access Key and Secret Key) to access S3, you must specify this item as `false`, and specify `aws.s3.accesskey` and `aws.s3.secretkey`.</li><li>If you use Instance Profile to access S3, you must specify this item as `true`.</li><li>If you use Assumed Role to access S3, you must specify this item as `true`, and specify `aws.s3.iamrolearn`.</li><li>And if you use an external AWS account, you must specify this item as `true`, and specify `aws.s3.iamrolearn` and `aws.s3.external_id`.</li></ul> | | aws.s3.access_key | The Access Key ID used to access your S3 bucket. | | aws.s3.secret_key | The Secret Access Key used to access your S3 bucket. | | aws.s3.iamrolearn | The ARN of the IAM role that has privileges on your S3 bucket in which your data files are stored. | | aws.s3.external_id | The external ID of the AWS account that is used for cross-account access to your S3 bucket. | | azure.blob.endpoint | The endpoint of your Azure Blob Storage Account, for example, `https://test.blob.core.windows.net`. | | azure.blob.shared_key | The Shared Key used to authorize requests for your Azure Blob Storage. | | azure.blob.sas_token | The shared access signatures (SAS) used to authorize requests for your Azure Blob Storage. | | aws.s3.enablepartitionedprefix | Whether to enable the Partitioned Prefix feature for the storage volume. Default: `false`. For more information about this feature, see . | | aws.s3.numpartitionedprefix | The number of prefixes to be created for the storage volume. Default: `256`. Valid range: [4, 1024].| If you use the default authentication credential of AWS SDK to access S3, set the following properties: ```SQL "enabled" = "{ true | false }", "aws.s3.region" = "<region>", "aws.s3.endpoint" = "<endpoint_url>", "aws.s3.useawssdkdefaultbehavior" = "true" ``` If you use IAM user-based credential (Access Key and Secret Key) to access S3, set the following properties: ```SQL "enabled" = "{ true | false }", "aws.s3.region" = "<region>", "aws.s3.endpoint" = "<endpoint_url>", "aws.s3.useawssdkdefaultbehavior" = "false", "aws.s3.useinstanceprofile" = "false", "aws.s3.accesskey" = "<accesskey>", "aws.s3.secretkey" = "<secretekey>" ``` If you use Instance Profile to access S3, set the following properties: ```SQL "enabled" = "{ true | false }", "aws.s3.region" = "<region>", "aws.s3.endpoint" = "<endpoint_url>", "aws.s3.useawssdkdefaultbehavior" = "false", "aws.s3.useinstanceprofile" = "true" ``` If you use Assumed Role to access S3, set the following properties: ```SQL "enabled" = "{ true | false }", "aws.s3.region" = "<region>", "aws.s3.endpoint" = "<endpoint_url>", "aws.s3.useawssdkdefaultbehavior" = "false", "aws.s3.useinstanceprofile" = "true",

= "<role_arn>" ``` If you use Assumed Role to access S3 from an external AWS account, set the following properties: ```SQL "enabled" = "{ true | false }", "aws.s3.region" = "<region>", "aws.s3.endpoint" = "<endpoint_url>", "aws.s3.useawssdkdefaultbehavior" = "false", "aws.s3.useinstanceprofile" = "true", "aws.s3.iamrolearn" = "<role_arn>", "aws.s3.externalid" = "<externalid>" ``` If you use GCP Cloud Storage, set the following properties: ```SQL "enabled" = "{ true | false }", -- For example: us-east-1 "aws.s3.region" = "<region>", -- For example: https://storage.googleapis.com "aws.s3.endpoint" = "<endpoint_url>", "aws.s3.accesskey" = "<accesskey>", "aws.s3.secretkey" = "<secretekey>" ``` If you use MinIO, set the following properties: ```SQL "enabled" = "{ true | false }", -- For example: us-east-1 "aws.s3.region" = "<region>", -- For example: http://172.26.xx.xxx:39000 "aws.s3.endpoint" = "<endpoint_url>", "aws.s3.accesskey" = "<accesskey>", "aws.s3.secretkey" = "<secretekey>" ``` Creating a storage volume on Azure Blob Storage is supported from v3.1.1 onwards. If you use Shared Key to access Azure Blob Storage, set the following properties: ```SQL "enabled" = "{ true | false }", "azure.blob.endpoint" = "<endpoint_url>", "azure.blob.sharedkey" = "<sharedkey>" ``` If you use shared access signatures (SAS) to access Azure Blob Storage, set the following properties: ```SQL "enabled" = "{ true | false }", "azure.blob.endpoint" = "<endpoint_url>", "azure.blob.sastoken" = "<sastoken>" ``` :::note The hierarchical namespace must be disabled when you create the Azure Blob Storage Account. ::: From v3.2.4, StarRocks supports creating storage volumes with the Partitioned Prefix feature for S3-compatible object storage systems. When this feature is enabled, StarRocks stores the data into multiple, uniformly prefixed partitions (sub-paths) under the bucket. It can easily multiply StarRocks' read and write performance on data files stored in the bucket because the QPS or throughput limit of the bucket is per partition. To enable this feature, set the following properties in addition to the above credential-related parameters: ```SQL "aws.s3.enablepartitionedprefix" = "{ true | false }", "aws.s3.numpartitionedprefix" = "<INT>" ``` :::note The Partitioned Prefix feature is only supported for S3-compatible object storage systems, that is, the `TYPE` of the storage volume must be `S3`. `LOCATIONS` of the storage volume must only contain the bucket name, for example, `s3://testbucket`. Specifying a sub-path after the bucket name is not allowed. Both properties are immutable once the storage volume is created. You cannot enable this feature when create a storage volume by using the FE configuration file fe.conf. ::: Example 1: Create a storage volume `mys3volume` for the AWS S3 bucket `defaultbucket`, use the IAM user-based credential (Access Key and Secret Key) to access S3, and enable it. ```SQL CREATE STORAGE VOLUME mys3volume TYPE = S3 LOCATIONS = ("s3://defaultbucket/test/") PROPERTIES ( "aws.s3.region" = "us-west-2", "aws.s3.endpoint" = "https://s3.us-west-2.amazonaws.com", "aws.s3.useawssdkdefaultbehavior" = "false", "aws.s3.useinstanceprofile" = "false", "aws.s3.access_key" = "xxxxxxxxxx", "aws.s3.secret_key" = "yyyyyyyyyy" ); ```