All Products
Search
Document Center

Cloud Storage Gateway:CreateGateway

Last Updated:Oct 10, 2024

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

Usage notes

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

  • You fully understand the billing methods and pricing of Cloud Storage Gateway (CSG).

  • You have created an Alibaba Cloud account.

  • You have activated CSG.

  • If you want to create a gateway that is deployed on Alibaba Cloud, make sure that you have created a virtual private cloud (VPC) and vSwitch in the region of the gateway.

  • If you want to create a gateway that is deployed on Alibaba Cloud, make sure that you have an Elastic Compute Service (ECS) instance in the VPC.

  • Make sure that you have a gateway cluster in the region where you want to create the gateway. If you do not have one, you can call the CreateStorageBundle operation to create one.

  • If you create a subscription gateway, you must pay for the subscription on the page indicated by the URL in the response to complete the gateway creation.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action

String

Yes

CreateGateway

The operation that you want to perform. Set the value to CreateGateway.

StorageBundleId

String

Yes

sb-0001b2otnkdxrigeq***

The ID of the gateway cluster.

Name

String

Yes

alex***

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

Description

String

No

Test

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

Type

String

Yes

File

The type of the gateway. Valid values:

  • File: file gateway

  • Iscsi: Internet Small Computer System Interface (iSCSI) gateway

Location

String

Yes

Cloud

The location of the gateway. Valid values:

  • Cloud: The gateway is deployed on Alibaba Cloud.

  • On_Premise: The gateway is deployed in your data center.

GatewayClass

String

No

Basic

The specifications of the gateway. The parameter affects the billing of the gateway. For more information, see Billing.

If you set the Location parameter to On_Premise, ignore this parameter.

If you set the Location parameter to Cloud, you can set this parameter to one of the following valid values:

  • Basic: a Basic gateway

  • Standard: a Standard gateway

  • Enhanced: an Enhanced gateway

  • Advanced: a Performance Optimized gateway

VSwitchId

String

No

vsw-bp1krhkglx3nahkb9s***

The ID of the vSwitch. If you set the Location parameter to On_Premise, ignore this parameter.

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

  • If no gateway resource is available in the zone where the specified vSwitch resides, create a vSwitch in another zone in the region.

PostPaid

Boolean

No

true

Specifies whether the billing method of the gateway is pay-as-you-go. The parameter affects the billing of the gateway. For more information, see Billing.

Valid values:

  • true: The billing method of the gateway is pay-as-you-go.

  • false: The billing method of the gateway is subscription.

Default value: false.

ReleaseAfterExpiration

Boolean

No

true

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

  • true: The gateway is released after it expires. The gateway becomes unavailable seven days after the gateway expires.

  • false: The gateway is not released after it expires. After the gateway expires, its billing method is changed to pay-as-you-go.

PublicNetworkBandwidth

Integer

No

5

The public bandwidth of the gateway. Unit: Mbit/s. The public bandwidth ranges from 5 Mbit/s to 200 Mbit/s. The parameter affects the billing of the gateway. For more information, see Billing.

Note
  • This parameter applies only to a cloud gateway. If you want to create an on-premises gateway, ignore this parameter.

  • If you specify 0 or do not specify a value, the default bandwidth is 5 Mbit/s.

ResourceRegionId

String

No

cn-hangzhou

The ID of the region in which the resources are located.

UntrustedEnvInstanceType

String

No

ecs.g6.large

The actual specification of the gateway in the CloudBox environment.

UntrustedEnvId

String

No

cb-2vcdsa32432***

The ID of the CloudBox instance.

SecondaryVSwitchId

String

No

vsw-bp1krhkglx3nahcx9s***

The parameter is discontinued.

Response parameters

Parameter

Type

Example

Description

BuyURL

String

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

The URL of the CSG buy page.

RequestId

String

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

The request ID.

Message

String

successful

The description of the request result.

GatewayId

String

gw-0001xv7je357zm9u6***

The gateway ID.

Code

String

200

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

Success

Boolean

true

Indicates whether the request was successful.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateGateway
&Location=Cloud
&Name=alex***
&StorageBundleId=sb-0001b2otnkdxrigeq***
&Type=File
&VSwitchId=vsw-bp1krhkglx3nahkb9s***
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateGatewayResponse>
    <Message>successful</Message>
    <RequestId>8E69E1A1-9076-4C8C-8ADF-ACD253886E22</RequestId>
    <GatewayId>gw-0001xv7je357zm9u6m0u</GatewayId>
    <BuyURL>https://common-buy.aliyun.com/?commodityCode=hcs_sgw_csg_pre&amp;request=%7B%22gateway_id%22:%22gw-0007va9bnidei3s8a09e%22,%22directBuy%22:%22false%22,%22gateway_class%22:%22standard%22,%22cache_cloud_efficiency_size%22:0%7D®ionId=cn-hangzhou#/buy</BuyURL>
    <Code>200</Code>
    <Success>true</Success>
</CreateGatewayResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "Message" : "successful",
  "RequestId" : "8E69E1A1-9076-4C8C-8ADF-ACD253886E22",
  "GatewayId" : "gw-0001xv7je357zm9u6m0u",
  "BuyURL" : "https://common-buy.aliyun.com/?commodityCode=hcs_sgw_csg_pre&request=%7B%22gateway_id%22:%22gw-0007va9bnidei3s8a09e%22,%22directBuy%22:%22false%22,%22gateway_class%22:%22standard%22,%22cache_cloud_efficiency_size%22:0%7D®ionId=cn-hangzhou#/buy",
  "Code" : "200",
  "Success" : true
}

Error codes

HttpCode

Error code

Error message

Description

400

EmptyGatewayName

You must enter a valid name for the gateway.

No gateway name is specified.

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 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 (-). It 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 description exceeds the upper limit of 255 characters.

400

EmptyStorageBundleId

You must enter a valid ID for the gateway cluster.

No gateway cluster ID is specified.

400

InvalidGatewayClass

The specified specification of the gateway is invalid.

The specified gateway specification is invalid.

400

InvalidGatewayType

The specified type of the gateway is invalid.

The specified gateway type is invalid.

400

InvalidVSwitchId

The specified VSwitch ID does not exist.

The specified vSwitch 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.

No cloud resources are unavailable. Select another gateway specification or a vSwitch in another zone.

400

DuplicateGatewayName

The specified name of the gateway already exists. You must specify a valid name.

The specified gateway name already exists. Specify a different gateway name.

400

InvalidGatewayBandwidth

The specified public network bandwidth for the gateway is invalid. The bandwidth ranges from 6 to 200 Mbit/s.

The public bandwidth is invalid. The public bandwidth of a gateway ranges from 6 to 200 Mbit/s.

400

GatewayBandwidthNotSupported

You cannot decrease the public network bandwidth of a On Premise Gateway.

You cannot configure the public bandwidth for an on-premises gateway.

400

InvalidGatewayLocation

The specified location of the gateway is invalid.

The location of the gateway is invalid.

404

StorageBundleNotExist

The name you specified for the gateway cluster does not exist. You must specify a valid parameter.

The specified gateway cluster does not exist.

For a list of error codes, see Service error codes.