All Products
Search
Document Center

Cloud Storage Gateway:CreateGateway

Last Updated:Oct 26, 2026

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

Operation description

Operation description

When you invoke this operation, take note of the following items:

  • - Make sure that you fully understand the billing methods and pricing of Cloud Storage Gateway before you invoke this operation.

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

  • You have activated Cloud Storage Gateway.

  • You have an active VPC and vSwitch in the region where you want to create a cloud gateway.

  • You have an active Elastic Computing Service in the region where you want to create a cloud gateway, and the server belongs to the VPC that you created.

  • Before you create a gateway, make sure that you have created a gateway cluster. If you have not created a gateway cluster, you can invoke the CreateStorageBundle operation to create one.

  • If the billing method of your gateway is subscription, you must use the purchase URL returned in the response to purchase the gateway after you invoke this operation.

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

hcs-sgw:CreateGateway

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

StorageBundleId

string

No

The ID of the gateway cluster. This parameter is required if you do not specify the ResourceRegionId parameter.

sb-0001b2otnkdxrigeq***

Name

string

Yes

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

alex***

Description

string

No

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

For testing

Category

string

No

The category of the gateway. Default value: Aliyun.

Aliyun

Type

string

Yes

The type of the gateway. Valid values:

  • File: file gateway.

  • Iscsi: block 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 specifications of the gateway. This parameter affects billing. For more information, see Billable items and billing methods.

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

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

  • Basic: Basic

  • Standard: Standard

  • Enhanced: Enhanced

  • Advanced: Advanced

Basic

VSwitchId

string

No

The ID of the vSwitch. If your gateway is deployed in an on-premises data center, you can ignore this parameter.

  • The vSwitch must be in the same VPC as the Elastic Computing Service server that you want to mount.

  • If no gateway resources can be allocated in the active zone where the current vSwitch is deployed, create a vSwitch in another zone.

vsw-bp1krhkglx3nahkb9s***

PostPaid

boolean

No

The billing method of the gateway. This parameter affects billing. 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 upon expiration when the billing method is upfront. Valid values:

  • true: The gateway undergoes automatic release and is directly accepted back upon expiration.

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

true

PublicNetworkBandwidth

integer

No

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

Note
  • This parameter is supported only by cloud gateways. Ignore this parameter for on-premises gateways.

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

  • If you set this parameter to 0 or leave it empty, the default value 5 is used.

5

ResourceRegionId

string

No

The ID of the resource region.

cn-hangzhou

UntrustedEnvInstanceType

string

No

The actual specifications of the gateway in an untrusted (CloudBox) scenario.

ecs.g6.large

UntrustedEnvId

string

No

Instance ID of the untrusted (CloudBox) instance.

cb-2vcdsa32432***

SecondaryVSwitchId

string

No

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

vsw-bp1krhkglx3nahcx9s***

Response elements

Element

Type

Description

Example

object

BuyURL

string

The purchase URL.

https://common-buy-intl.alibabacloud.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 ID of the gateway.

gw-0001xv7je357zm9u6***

Code

string

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

200

Success

boolean

Indicates whether the request is successful.

true

Examples

Success response

JSON format

{
  "BuyURL": "https://common-buy-intl.alibabacloud.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.