調用CreateSnatEntry介面在SNAT列表中添加SNAT條目。
介面說明
本介面可以為增強型公網 NAT Gateway和 VPC NAT Gateway添加 SNAT 條目,文中出現的 NAT Gateway不做具體的區分。
調用本介面添加 SNAT 條目時,請瞭解以下內容:
-
CreateSnatEntry 介面屬於非同步介面,即系統會先返回一個 SNAT 條目 ID,但該 SNAT 條目並未添加完成,系統背景新增工作仍在進行。您可以調用 DescribeSnatTableEntries 查詢 SNAT 條目的狀態:
-
當 SNAT 條目處於 Pending 狀態時,表示 SNAT 條目正在添加中,在該狀態下,您只能執行查詢操作,不能執行其他動作。
-
當 SNAT 條目處於 Available 狀態時,表示 SNAT 條目添加完成。
-
-
SNAT 條目中指定的交換器和 ECS 執行個體必須在 NAT Gateway所屬的 VPC 內。
-
每個交換器和 ECS 執行個體只能屬於一個 SNAT 條目。
-
如果交換器中存在高可用虛擬 IP 執行個體,則無法添加 SNAT 條目。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| RegionId |
string |
是 |
NAT Gateway所在的地區 ID。 您可以通過調用 DescribeRegions 介面擷取地區 ID。 枚舉值:
|
cn-hangzhou |
| SnatTableId |
string |
是 |
SNAT 表的 ID。 |
stb-bp190wu8io1vgev**** |
| SourceVSwitchId |
string |
否 |
交換器的 ID。
說明
參數 SourceCIDR 和參數 SourceVSwtichId 必須輸入一個且不能都輸入。 |
vsw-bp1nhx2s9ui5o**** |
| SourceCIDR |
string |
否 |
輸入 VPC、交換器或 ECS 執行個體的網段,還可以輸入任意網段。 SNAT 條目有以下幾種粒度:
說明
參數 SourceCIDR 和參數 SourceVSwtichId 必須輸入一個且不能都輸入。 |
10.1.1.0/24 |
| SnatIp |
string |
否 |
為公網 NAT Gateway添加 SNAT 條目時 :
說明
指定多個 EIP 配置 SNAT IP 位址集區時,Business Connectivity會通過雜湊演算法分配到多個 EIP,由於每個串連的流量不同,可能會出現多 EIP 業務流量不均勻的情況,建議您將每個 EIP 都加入到同一個共用頻寬中以避免單 EIP 頻寬達到上限導致業務受損。 為 VPC NAT Gateway添加 SNAT 條目時:
|
47.98.XX.XX |
| SnatEntryName |
string |
否 |
SNAT 條目的名稱。 長度為 2~128 個字元,必須以大小寫字母或中文開頭,但不能以 |
SnatEntry-1 |
| ClientToken |
string |
否 |
用戶端 Token,用於保證請求的等冪性。 從您的用戶端產生一個參數值,確保不同請求間該參數值唯一。 說明
若您未指定,則系統自動使用 API 請求的 Requestld 作為 ClientToken 標識。每次 API 請求的 Requestld 可能不一樣。 |
02fb3da4-130e-11e9-8e44**** |
| EipAffinity |
integer |
否 |
是否開啟 IP 親和性。取值:
說明
開啟 IP 親和性開關後,如果 SNAT 條目綁定多個 EIP 或 NAT IP,同一個用戶端訪問同一目的 IP 時將使用相同的 EIP 或 NAT IP 進行訪問,否則用戶端將從綁定的 EIP 或 NAT IP 中隨機選取進行訪問。 |
1 |
| NetworkInterfaceId |
string |
否 |
彈性網卡 ID。 說明
會將彈性網卡的 IPv4 地址集作為 SNAT 地址。 |
eni-gw8g131ef2dnbu3k**** |
| DryRun |
boolean |
否 |
是否只預檢此次請求,取值:
|
false |
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
SNAT 條目 ID。 |
||
| SnatEntryId |
string |
SNAT 條目 ID。 |
snat-kmd6nv8fy**** |
| RequestId |
string |
請求 ID。 |
2315DEB7-5E92-423A-91F7-4C1EC9AD**** |
樣本
正常返回樣本
JSON格式
{
"SnatEntryId": "snat-kmd6nv8fy****",
"RequestId": "2315DEB7-5E92-423A-91F7-4C1EC9AD****"
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 400 | UnsupportedFeature.PrivateLinkEnabled | The feature of PrivateLinkEnabled is not supported. | |
| 400 | InvalidSourceCIDR.Malformed | SourceCIDR is illegal. | |
| 400 | NOT_ALLOW_USE_SOURCECIDR_OUTSIDEVPC | The User not in sourcecidr_unlimited_outsidevpc white list. Cannot use SourceCidr outside VpcCidr. | |
| 400 | NOT_ALLOW_USE_SOURCECIDR_AUTODEFINE | The User not in sourcecidr_unlimited_insidevpc white list. Cannot use SourceCidr auto defined. | |
| 400 | NOT_ALLOW_USE_SOURCECIDR_CONTAINSZERO | The User not in sourcecidr_unlimited_outsidevpc_containszero white list. Cannot use SourceCidr outside VpcCidr. | |
| 400 | Forbidden.IpHasBeenUsedInDnat | The snat ip can't be used. Because it has been used in dnat | |
| 400 | Forbidden.SourceVSwitchId.IncludeHaVip | There is some HaVips under specified VSwitch | 該交換器下有關聯的HaVip。 |
| 400 | InvalidSnatIp.Malformed | The specified SnatIp is not a valid IP address. | |
| 400 | SNAT_IP_POOL_COUNT_TOO_MANY | The Snat pool ip too many. | |
| 400 | Forbidden.SnatEntryCountLimited | SNAT entry in the specified SNAT table reach its limit. | SNAT條目數量已達到配額。 |
| 400 | NOT_ALLOW_USE_SOURCECIDR | The User not in nat_scope_unlimited white list. Cannot use SourceCidr param. | |
| 400 | INVALID_PARAMETER | The parameter invalid. | |
| 400 | Forbidden.SourceVSwitchId.Duplicated | The specified SourceCIDRis duplicated. | |
| 400 | Forbidden.IpUsedInForwardTable | The specified SnatIp already used in forward table | |
| 400 | Forbindden | The specified Instance already bind eip | |
| 400 | EIP_NOT_SUPPORT_SNAT_POOL | The Eip cannot support snat pool | |
| 400 | EIP_NOT_IN_GATEWAY | The Eip not in nat gateway | |
| 400 | OperationUnsupported.CidrConflict | The specified CIDR block conflicts with an existing SNAT entry. | 您指定的CIDR的網段與已有的SNAT條目衝突。 |
| 400 | InvalidNatGatewayId.NotFound | The NatGateway instance not exist. | |
| 400 | InvalidParameter.Name.Malformed | The specified Name is not valid. | |
| 400 | InvalidParameter.SnatIp | Ip semgment must be subnet cidr. | |
| 400 | QuotaExceeded.SnatIp | Public ip number exceeds quota. | |
| 400 | OperationUnsupported.EipInBinding | Create snat entry with eip in associating status is unsupported. | 建立snat不可以使用綁定中的eip |
| 400 | OperationFailed.VSwitchNotInVpc | The specified vswitch and natgateway are not in the same vpc. | |
| 400 | QuotaExceeded.SnatEntry | SNAT entry in the specified SNAT table reach it?s limit. | |
| 400 | IncorrectStatus.NATGW | NATGW status is invalid. | NAT Gateway的狀態不正確。 |
| 400 | IncorrectStatus.VSwitch | The specified vSwitch status is invalid. | 虛擬交換器狀態異常。 |
| 400 | MissingParam.SnatIp | The input parameter SnatIp that is mandatory for processing this request is not supplied. | 為公網NAT或私網NAT建立Snat規則時需要指定SnatIp參數。 |
| 400 | MissingParam.NetworkInterfaceId | The input parameter NetworkInterfaceId that is mandatory for processing this request is not supplied. | 為開啟了私網連結服務的NAT建立Snat規則時需要指定NetworkInterfaceId參數。 |
| 400 | ParamExclusive.SnatIpAndNetworkInterfaceId | SnatIp and NetworkInterfaceId is mutually exclusive when create a snat entry for nat. | 為NAT Gateway執行個體建立SNAT規則時,不能同時傳入SnatIp參數和NetworkInterfaceId參數。 |
| 400 | IllegalParam.NetworkInterfaceId | The param of NetworkInterfaceId is illegal. | NetworkInterfaceId參數不合法。 |
| 400 | OperationUnsupported.EipNatBWPCheck | The EIP is not associated with a NAT service plan. | 當前EIP不屬於NAT頻寬包。 |
| 400 | OperationUnsupported.EipNatGWCheck | The operation failed because the EIP is not bound to this NAT Gateway. | 操作失敗, 因為EIP未綁定到此NAT Gateway. |
| 400 | OperationFailed.SnatIpPoolCbwpRules | The operation failed because the SNAT rule IPs are added to multi bandwidth packages. | 操作失敗, 因為SNAT規則IP位址集區被添加到多個頻寬包. |
| 400 | IncorrectStatus.SnatEntry | The SNAT rule status is invalid. Please try again later. | SNAT規則處於中間態, 或狀態異常. 請稍後重試. |
| 400 | IncorrectStatus.NatIp | NatIp status is invalid, please try again later. | NatIp處於中間態, 請稍後重試. |
| 400 | OperationUnsupported.EipNatIpCheck | The operation failed because the EIP is not bound to this NAT gateway. | 操作失敗, 因為EIP未綁定此NAT Gateway. |
| 400 | OperationFailed.SnatIpPoolBwpRules | The operation failed because the IP in Snat entryl was added to multiple NAT bandwidth packets. | 操作失敗, 因為Snat規則IP位址集區中的IP被添加到多個NAT頻寬包. |
| 400 | OperationFailed.SnatIpsCheck | The operation fails because some IPs address in the SNAT entry are not added to common bandwidth packet. | 操作失敗, 因為Snat規則IP位址集區中存在IP地址未添加共用頻寬包. |
| 500 | DefaultValidate.Error | validte fail. | |
| 500 | OperationFailed.CrateSnatEntryTimeOut | Operation failed because create snatEntry timeout. | |
| 404 | InvalidRegionId.NotFound | The specified RegionId does not exist in our records. | |
| 404 | InvalidSnatTableId.NotFound | Specified SNAT table does not exist. | |
| 404 | InvalidVSwitchId.NotFound | The specified virtual switch does not exists. | |
| 404 | InvalidSnatIp.NotFound | Specified SnatIp does not found on the NAT Gateway | |
| 404 | ResourceNotFound.NatGateway | The NatGateway instance not exist. | 此nat網關不存在 |
| 404 | ResourceNotFound.NatIp | The NatIp instance not exist. | |
| 404 | ResourceNotFound.VSwitch | The specified resource of %s is not found. | 指定的vSwitch不存在,請檢查您的輸入是否正確 |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。