All Products
Search
Document Center

Cloud Storage Gateway:CreateGateway

Last Updated:Aug 04, 2025

Creates a subscription or pay-as-you-go gateway.

Operation description

Description

Before you call this operation, make sure that the following requirements are met:

  • You understand the billing methods and pricing of Cloud Storage Gateway.

  • You have registered an Alibaba Cloud account and completed real-name verification.

  • You have activated the Cloud Storage Gateway service.

  • A virtual private cloud (VPC) and a vSwitch are available in the region where you want to create the cloud gateway.

  • An Elastic Compute Service (ECS) instance is available in the region where you want to create the cloud gateway. The ECS instance is assigned to the VPC.

  • A gateway cluster is available. If a gateway cluster is not available, you can call the CreateStorageBundle operation to create one.

  • If the gateway uses the subscription billing method, you must use the purchase URL returned by this operation to complete the purchase after the gateway is created.

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 support 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

hcs-sgw:CreateGateway

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

StorageBundleId

string

No

The ID of the gateway cluster. You must specify this parameter if you do not specify ResourceRegionId.

sb-0001b2otnkdxrigeq***

Name

string

Yes

The name of the gateway. The name must be 60 characters in length. The name must start with a letter or a Chinese character. The name can contain letters, Chinese characters, digits, underscores (_), hyphens (-), and periods (.).

alex***

Description

string

No

The description of the gateway. The description can be 0 to 255 characters in length.

Category

string

No

The category of the gateway. The default value is Aliyun.

Type

string

Yes

The type of the gateway. Valid values:

  • File: file gateway.

  • Iscsi: iSCSI gateway.

File

Location

string

Yes

The location of the gateway. Valid values:

  • Cloud: cloud gateway.

  • On_Premise: on-premises gateway.

Cloud

GatewayClass

string

No

The gateway class. This parameter is related to fees. For more information, see Billable items and billing methods.

If your gateway is deployed in a data center, which is an on-premises gateway, you can ignore this parameter.

If your gateway is deployed on Alibaba Cloud, which is a cloud gateway, valid values are:

  • Basic: Basic

  • Standard: Medium

  • Enhanced: Enhanced

  • Advanced: Performance

Basic

VSwitchId

string

No

The ID of the virtual switch. If your gateway is deployed in a data center, you can ignore this parameter.

  • The vSwitch must be in the same VPC as the ECS instance that you want to attach.

  • If no gateway resources can be allocated in the zone where the vSwitch resides, create a vSwitch in another zone.

vsw-bp1krhkglx3nahkb9s***

PostPaid

boolean

No

The billing method of the gateway. This parameter is related to fees. For more information, see Billable items and billing methods. Valid values:

  • true: pay-as-you-go.

  • false: subscription.

Default value: false (subscription).

true

ReleaseAfterExpiration

boolean

No

Specifies whether to release the gateway when the subscription expires. Valid values:

true: The gateway is automatically released.

false: The billing method of the gateway is automatically changed to pay-as-you-go after the subscription expires.

true

PublicNetworkBandwidth

integer

No

The public bandwidth for data transmission. Unit: Mbit/s. Valid values: 5 to 200. This parameter is related to fees. For more information, see Billable items and billing methods.

Note
  • This parameter is supported only for cloud gateways. You can ignore this parameter for on-premises gateways.

  • Configure this parameter only when you need to mount an OSS bucket across regions.

  • If you specify 0 or do not specify this parameter, the default value is 5.

50

ResourceRegionId

string

No

The ID of the resource region.

cn-hangzhou

UntrustedEnvInstanceType

string

No

The actual gateway class in an untrusted environment (CloudBox).

UntrustedEnvId

string

No

The ID of the instance in an untrusted environment (CloudBox).

SecondaryVSwitchId

string

No

The ID of the vSwitch for the secondary node of the high-availability (HA) gateway.

Response parameters

Parameter

Type

Description

Example

object

BuyURL

string

The purchase URL.

https://common-buy.aliyun.com/?commodityCode=hcs_sgw_csg_pre&request={"gateway_id":"gw-0007va9bnidei3s8a***","directBuy":"false","gateway_class":"standard","cache_cloud_efficiency_size":0}&regionId=cn-hangzhou#/buy

RequestId

string

The request ID.

8E69E1A1-9076-4C8C-8ADF-ACD253886E22

Message

string

The description of the request result.

successful

GatewayId

string

The gateway ID.

gw-0001xv7je357zm9u6***

Code

string

The status code. A status code of 200 indicates that the request was successful.

200

Success

boolean

Indicates whether the request was successful.

true

Examples

Success response

JSON format

{
  "BuyURL": "https://common-buy.aliyun.com/?commodityCode=hcs_sgw_csg_pre&request={\"gateway_id\":\"gw-0007va9bnidei3s8a***\",\"directBuy\":\"false\",\"gateway_class\":\"standard\",\"cache_cloud_efficiency_size\":0}&regionId=cn-hangzhou#/buy",
  "RequestId": "8E69E1A1-9076-4C8C-8ADF-ACD253886E22",
  "Message": "successful",
  "GatewayId": "gw-0001xv7je357zm9u6***",
  "Code": "200",
  "Success": true
}

Error codes

HTTP status code

Error code

Error message

Description

400 EmptyGatewayName You must enter a valid name for the gateway. You must enter a valid name for the gateway.
400 InvalidGatewayName The specified name of the gateway is invalid. The name must be 1 to 60 characters in length and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter. The specified name of the gateway is invalid. The name must be 1 to 60 characters in length and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.
400 DescriptionOverLimit The length of the specified gateway description exceeds the maximum limit. The description cannot exceed 255 characters. The length of the specified gateway description exceeds the maximum limit. The description cannot exceed 255 characters.
400 EmptyStorageBundleId You must enter a valid ID for the gateway cluster. You must enter a valid ID for the gateway cluster.
400 InvalidGatewayClass The specified specification of the gateway is invalid. The specified specification of the gateway is invalid.
400 InvalidGatewayType The specified type of the gateway is invalid. The specified type of the gateway is invalid.
400 InvalidVSwitchId The specified VSwitch ID does not exist. The specified VSwitch ID does not exist.
400 NoAvailableOnlineResource There are no cloud gateways available. We recommend that you select a different specification or VSwitch that resides in another zone. There are no cloud gateways available. We recommend that you select a different specification or VSwitch that resides in another zone.
400 DuplicateGatewayName The specified name of the gateway already exists. You must specify a valid name. The specified name of the gateway already exists. You must specify a valid name.
400 InvalidGatewayBandwidth The specified public network bandwidth for the gateway is invalid. The bandwidth ranges from 6 to 200 Mbit/s. The specified public network bandwidth for the gateway is invalid. The bandwidth ranges from 6 to 200 Mbit/s.
400 GatewayBandwidthNotSupported You cannot decrease the public network bandwidth of a On Premise Gateway. You cannot decrease the public network bandwidth of a On Premise Gateway.
400 InvalidGatewayLocation The specified location of the gateway is invalid. The specified location of the gateway is invalid.
400 ServiceReleased Service is released, please open service again. Service is released, please open service again.
404 StorageBundleNotExist The name you specified for the gateway cluster does not exist. You must specify a valid parameter. The name you specified for the gateway cluster does not exist. You must specify a valid parameter.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.