CreateNatGateway API を呼び出して、拡張 NAT ゲートウェイまたは VPC NAT ゲートウェイを作成します。
操作説明
この操作を呼び出す前に、以下の点にご注意ください。
-
NAT ゲートウェイを初めて作成する際、AliyunServiceRoleForNatgw という名前のサービスリンクロールが自動的に作成されます。このロールには AliyunServiceRolePolicyForNatgw という権限ポリシーがアタッチされ、NAT ゲートウェイが他のクラウドリソースにアクセスできるようになります。詳細については、「サービスリンクロール」をご参照ください。
-
拡張 NAT ゲートウェイを作成すると、システムが自動的に VPC のルートテーブルにルートエントリを追加し、トラフィックを NAT ゲートウェイにルーティングします。このエントリでは、宛先 CIDR ブロックが 0.0.0.0/0、ネクストホップが NAT ゲートウェイに設定されます。
-
CreateNatGateway 操作は非同期です。リクエストを送信すると、システムは NAT ゲートウェイ(パブリックまたは VPC)のインスタンス ID を返し、作成タスクはバックグラウンドで実行されます。DescribeNatGateways 操作を呼び出して、NAT ゲートウェイのステータスを照会できます。
-
ステータスが Creating の場合、NAT ゲートウェイは作成中です。この状態では、照会操作のみ実行可能です。
-
ステータスが Available の場合、NAT ゲートウェイは正常に作成されています。
-
NAT ゲートウェイの作成には約 1~3 分かかります。しばらくお待ちください。
今すぐお試しください
テスト
RAM 認証
リクエストパラメーター
|
パラメーター |
型 |
必須 / 任意 |
説明 |
例 |
| RegionId |
string |
必須 |
NAT ゲートウェイを作成するリージョンの ID です。 DescribeRegions 操作を呼び出して、リージョン ID を取得できます。 |
cn-hangzhou |
| VpcId |
string |
必須 |
NAT ゲートウェイを作成する仮想プライベートクラウド (VPC) の ID です。 |
vpc-bp1di7uewzmtvfuq8**** |
| Name |
string |
任意 |
NAT ゲートウェイの名前です。 名前は 2~128 文字で、英字または漢字で始まり、数字、アンダースコア (_)、ハイフン (-) を含めることができます。 このパラメーターを指定しない場合、システムが自動的に NAT ゲートウェイの名前を指定します。 |
fortest |
| Description |
string |
任意 |
NAT ゲートウェイの説明です。 説明は 2~256 文字で、 |
testnat |
| ClientToken |
string |
任意 |
リクエストのべき等性を保証するために使用されるクライアントトークンです。 トークンは任意で作成できますが、異なるリクエスト間で一意であることを保証する必要があります。 説明
このパラメーターを指定しない場合、システムは自動的に リクエスト ID を クライアントトークン として使用します。リクエスト ID は各リクエストで異なる場合があります。 |
5A2CFF0E-5718-45B5-9D4D-70B3FF3898 |
| Spec |
string |
任意 |
サブスクリプションベースのパブリック NAT ゲートウェイは新規購入できなくなりました。このパラメーターは使用されません。 |
无效参数 |
| InstanceChargeType |
string |
任意 |
NAT ゲートウェイの課金方法です。以下の値を設定します。 PostPaid (デフォルト): 従量課金 詳細については、「パブリック NAT ゲートウェイの課金」および「VPC NAT ゲートウェイの課金」をご参照ください。 |
PostPaid |
| PricingCycle |
string |
任意 |
サブスクリプションベースのパブリック NAT ゲートウェイは新規購入できなくなりました。このパラメーターは使用されません。 |
无效参数 |
| Duration |
string |
任意 |
サブスクリプションベースのパブリック NAT ゲートウェイは新規購入できなくなりました。このパラメーターは使用されません。 |
无效参数 |
| AutoPay |
boolean |
任意 |
サブスクリプションベースのパブリック NAT ゲートウェイは新規購入できなくなりました。このパラメーターは使用されません。 |
无效参数 |
| VSwitchId |
string |
任意 |
NAT ゲートウェイが属する vSwitch の ID です。 NAT ゲートウェイを作成する際、NAT ゲートウェイが属する vSwitch を指定する必要があります。その後、システムはその vSwitch から NAT ゲートウェイにプライベート IP アドレスを割り当てます。
説明
ListEnhancedNatGatewayAvailableZones 操作を呼び出して NAT ゲートウェイをサポートするゾーンを照会し、DescribeVSwitches 操作を呼び出して vSwitch 内のアイドル IP アドレス数を照会できます。 |
vsw-bp1e3se98n9fq8hle**** |
| NatType |
string |
任意 |
NAT ゲートウェイのタイプです。Enhanced を設定すると、拡張 NAT ゲートウェイが指定されます。 |
Enhanced |
| InternetChargeType |
string |
任意 |
NAT ゲートウェイの課金方法です。PayByLcu を設定すると、従量課金の NAT ゲートウェイとなり、LCU 単位で測定されます。 |
PayByLcu |
| NetworkType |
string |
任意 |
作成する NAT ゲートウェイのタイプです。有効な値は以下のとおりです。
|
internet |
SecurityProtectionEnabled
deprecated
|
boolean |
任意 |
ファイアウォール機能を有効にするかどうかを指定します。有効な値は以下のとおりです。
|
false |
| IcmpReplyEnabled |
boolean |
任意 |
ICMP 応答を有効にするかどうかを指定します。有効な値は以下のとおりです。
|
true |
| PrivateLinkEnabled |
boolean |
任意 |
PrivateLink を有効にするかどうかを指定します。有効な値は以下のとおりです。
|
false |
| EipBindMode |
string |
任意 |
EIP を NAT ゲートウェイに関連付けるモードです。有効な値は以下のとおりです。
|
MULTI_BINDED |
| Tag |
array<object> |
任意 |
タグです。 |
MULTI_BINDED |
|
object |
任意 |
|||
| Key |
string |
任意 |
タグキーです。最大 20 個のタグキーを指定できます。タグキーは空文字列にできません。長さは 1~128 文字で、 |
TestKey |
| Value |
string |
任意 |
タグ値です。最大 20 個のタグ値を指定できます。タグ値は空文字列にできます。長さは 0~128 文字で、 |
TestValue |
| AccessMode |
object |
任意 |
VPC NAT ゲートウェイのリバースエンドポイントアクセス用のアクセスモードです。 |
MULTI_BINDED |
| ModeValue |
string |
任意 |
アクセスモードです。有効な値は以下のとおりです。
説明
このパラメーターは PrivateLinkEnabled が true に設定されている場合にのみ有効です。 |
route |
| TunnelType |
string |
任意 |
トンネルのタイプです。有効な値は以下のとおりです。
説明
このパラメーターはアクセスモードがトンネルの場合にのみ有効です。 |
geneve |
| NatIp |
string |
任意 |
NAT ゲートウェイのプライベート IP アドレスです。NAT ゲートウェイが属する vSwitch の CIDR ブロック内の未使用 IP アドレスを使用します。このパラメーターを空のままにすると、IP アドレスがランダムに割り当てられます。 |
192.168.0.2 |
| Ipv4Prefix |
string |
任意 |
IP アドレスプレフィックスです。NAT IP アドレスはこのプレフィックスから作成されます。NAT ゲートウェイが属する vSwitch で割り当てられていない予約済み CIDR ブロックを使用してください。 |
192.168.0.0/28 |
レスポンスフィールド
|
フィールド |
型 |
説明 |
例 |
|
object |
レスポンスボディです。 |
||
| NatGatewayId |
string |
NAT Gateway のインスタンス ID です。 |
ngw-112za33e4**** |
| RequestId |
string |
リクエスト ID です。 |
2315DEB7-5E92-423A-91F7-4C1EC9AD97C3 |
| ForwardTableIds |
object |
||
| ForwardTableId |
array |
DNAT リストです。 |
|
|
string |
DNAT 転送テーブルの ID です。 |
ftb-11tc6xgmv**** |
|
| SnatTableIds |
object |
||
| SnatTableId |
array |
SNAT リストです。 |
|
|
string |
SNAT テーブルの ID です。 |
stb-SnatTableIds**** |
|
| FullNatTableIds |
object |
||
| FullNatTableId |
array |
FULLNAT リストです。 |
|
|
string |
FULLNAT テーブルの ID です。 |
fulltb-gw88z7hhlv43rmb26**** |
例
成功レスポンス
JSONJSON
{
"NatGatewayId": "ngw-112za33e4****",
"RequestId": "2315DEB7-5E92-423A-91F7-4C1EC9AD97C3",
"ForwardTableIds": {
"ForwardTableId": [
"ftb-11tc6xgmv****"
]
},
"SnatTableIds": {
"SnatTableId": [
"stb-SnatTableIds****"
]
},
"FullNatTableIds": {
"FullNatTableId": [
"fulltb-gw88z7hhlv43rmb26****"
]
}
}
エラーコード
|
HTTP ステータスコード |
エラーコード |
エラーメッセージ |
説明 |
|---|---|---|---|
| 400 | Forbidden.NatPayBySpec | Pay-by-specification NAT is no longer supported. Newly purchased pay-as-you-go NAT gateways only support the pay-by-CU metering method. | |
| 400 | DependencyViolation.FullNatEntry | The specified resource of %s depends on %s, so the operation cannot be completed. | |
| 400 | UnsupportedFeature.InternetChargeType | The feature of InternetChargeType is not supported. | |
| 400 | InvalidVPCStatus | vpc incorrect status. | |
| 400 | InvalidNatGatewayName.MalFormed | NatGateway name is not valid. | |
| 400 | InvalidNatGatewayDescription.MalFormed | NatGateway description is not valid. | |
| 400 | MissingParameter.BandwidthPackage | only support one BandwidthPackage be created with NatGateway. | |
| 400 | OperationDenied | The user cannot allow to create natgw, please call PD to authorize | |
| 400 | RouterEntryConflict.Duplicated | A route entry already exists, which CIDR is '0.0.0.0/0' | |
| 400 | MissingParameter | Miss mandatory parameter. | |
| 400 | QuotaExceeded.BandwidthPackageIps | The specified ipCount exceeded quota. | |
| 400 | AllocateIpFailed | Alloc bandwidthPackage ips failed, maybe no available ip. | |
| 400 | InvalidParameter.Name.Malformed | The specified Name is not valid. | |
| 400 | InvalidParameter.Description.Malformed | The specified Description is not valid. | |
| 400 | ZONE_NO_AVAILABLE_IP | The Zone have no available ip. | |
| 400 | ParameterIllegal | ipCount,bandwidth parameter invalid | |
| 400 | InvalidParameter.BandwidthPackage.n.ISP.ValueNotSupport | The specified ISP of BandwidthPackage is not valid. | |
| 400 | InvalidNatGatewayId.NotFound | The NatGatewayId not exist. | |
| 400 | VpcStatusError | The Vpc is creating . | |
| 400 | InvalidParameter.Spec.ValueNotSupported | The specified Spec is not valid. | |
| 400 | TaskConflict | The operation is too frequent, TaskConflict. | |
| 400 | COMMODITY.INVALID_COMPONENT | The instance component is invalid. | |
| 400 | CreateNatGateway.RouteConflict.DynamicRoute | Route conflict exists in routing table. | |
| 400 | OperationUnsupported.MultiNatGateway | More than one natGateway per vpc is unsupported. | |
| 400 | Forbidden.CheckEntryRuleQuota | Route entry quota rule check error. | |
| 400 | OperationFailed.UnpaidBillsExist | The account has unpaid bills. Please pay your overdue bill first. | |
| 400 | IncorrectStatus.RouteEntry | Specified routeEntry status error. | |
| 400 | OperationFailed.RiskControl | Risk control check failed. | |
| 400 | OperationFailed.TokenVerfiy | Token verify failed. | |
| 400 | IllegalParam.Name | The specified Name is invalid, shorter than 2 characters. | |
| 400 | OperationFailed.EnhancedQuotaExceed | Enhanced nat gateway per vpc quota is exceeded | |
| 400 | NoPermission.CreateServiceLinkedRole | You are not authorized to create service linked role | |
| 400 | OperationFailed.EnhancedInventoryNotEnough | Operation failed because inventory is not enough. | |
| 400 | OperationFailed.VswNotBelongToVpc | Operation failed because the specified VSwitch is not bound to the same VPC with NAT gateway. | |
| 400 | OperationFailed.EnhancedUserIsUnAuthorized | Operation failed because the user is not authorized to create an enhanced NAT gateway. | |
| 400 | OperationUnsupported.PrePaidPyByLcu | The operation failed because the subscription NAT gateway does not support the pay-by-LCU billing method. | |
| 400 | OperationFailed.NormalInventoryNotEnough | Standard NAT gateways are no longer offered. You can create enhanced NAT gateways and set the correct natType. | |
| 400 | OperationFailed.VSwitchNoAvailableIp | Operation failed because the specified vswitch does not have availabe ip. | |
| 400 | UnsupportedFeature.IcmpReplyEnabled | The feature of IcmpReplyEnabled is not supported. | |
| 400 | UnsupportedFeature.SecurityProtectionEnabled | The feature of SecurityProtectionEnabled is not supported. | |
| 400 | OperationFailed.RegionConvert | Operation failed because do not find region info. | |
| 400 | UnsupportedFeature.VpcNat | The feature of VpcNat is not supported. | |
| 400 | InvalidVSWITCHID.NotFound | The specified resource of %s is not found. | |
| 400 | Forbidden.OperateShareResource | Operate share resource is forbidden. | |
| 400 | IncorrectStatus.VSWITCH | The status of VSWITCH is incorrect. | |
| 400 | OperationFailed.VpcNatGatewayInventoryNotEnough | The operation is failed because of inventory is not enough. | |
| 400 | OperationFailed.VpcNatGatewayCheckInventory | The operation is failed because of check inventory result is unexpected | |
| 400 | ExclusiveParam.%sAnd%s | The param of %s and %s are mutually exclusive. | |
| 400 | SecurityGroupType.NotSupported | The specified security group type is not supported. | |
| 400 | SecurityGroup.NotExist | The specified security group is not exist. | |
| 400 | OperationFailed.ContainForbiddenLabel | There is a label that prohibits ordering, please contact your distributor for processing. | |
| 400 | OperationDenied.PrePaidInstance | The operation is not allowed because prepaid instance is no longer supported. | |
| 400 | UnsupportedFeature.Geneve | The feature of Geneve is not supported. | |
| 400 | OperationFailed.NoAvailableResource | The Zone have no available resource. | |
| 400 | ExclusiveParam.AccessModeValueAndAccessTunnelType | The specified param AccessModeValue and AccessTunnelType are mutually exclusive. | |
| 400 | ExclusiveParam.PrivateLinkModeAndAccessMode | The specified param PrivateLinkMode and AccessMode are mutually exclusive. | |
| 400 | ExclusiveParam.PrivateLinkEnabledAndAccessMode | The specified paramPrivateLinkEnabled and AccessMode are mutually exclusive. | |
| 400 | UnsupportedFeature.AccessModeValue | The feature of AccessMode.ModeValue(%s) is not supported. | |
| 400 | IllegalParam.AccessTunnelType | The request parameter AccessMode.TunnelType is illegal. | |
| 400 | IllegalParam.AccessModeValue | The request parameter AccessMode.ModeValue is illegal. | |
| 400 | OperationFailed.VSwitchStatusError | The vSwitch is creating . | |
| 400 | UnsupportedFeature.PrivateLinkMode | The feature of %s is not supported. | |
| 400 | OperationFailed.EcsNetworkInterfaceQuotaNotSatisfy | ECS network interface quota is not satisfy. | |
| 400 | OperationFailed.NoNameAuthentication | You have not passed the real name authentication and do not meet the purchase conditions. Please log in to the user center for real-name authentication. | |
| 400 | Mismatch.NatIpAndNatIpCidr | The %s and %s are mismatched. | |
| 400 | Mismatch.Ipv4PrefixAndNatIpCidr | The %s and %s are mismatched. | |
| 400 | ResourceAlreadyExist.NatIp | The specified resource of NatIp has already exist. | |
| 400 | Mismatch.Ipv4PrefixAndCidrReservations | The %s and %s are mismatched. | |
| 400 | ResourceAlreadyAssociated.Ipv4Prefix | %s is already associated. | |
| 400 | ResourceNotEnough.Ipv4Prefix | The resource of %s is not enough. | |
| 400 | ResourceNotFound.Ipv4Prefix | The resource of s% is not found. | |
| 400 | ResourceAlreadyAssociated.NatIp | The resource of %s was already associated. | |
| 400 | ResourceNotEnough.NatIp | The specified resource of NatIp is not enough. | |
| 400 | ResourceNotFound.NatIp | The specified resource of %s is not found. | |
| 400 | IllegalParam.Ipv4Prefix | The param of %s is illegal, must be /28 network segment. | |
| 400 | IllegalParam.NatIp | The param of %s is illegal. | |
| 400 | OperationUnsupported.EnhancedRegion | Region not support. | |
| 400 | IncorrectStatus.RouteTableStatus | The route table status is invaild. Please try again later. | |
| 400 | OperationUnsupported.User | The current user does not support this operation. | |
| 400 | OperationUnsupported.EnhancedCURegion | Operation failed because of this region not unsupported. | |
| 400 | OrderError.NoAvailablePaymentMethod | Order payment parameter is not available. | |
| 400 | OrderError.BasicInfoUncompleted | Order basic parameter is not completed. | |
| 400 | OperationUnsupported.Region | Operation unsupport this region parameter. | |
| 400 | InvalidParameter.SingleZone | Operation failed because current user not support create single zone nat. | |
| 500 | OrderError.NatGateway | The Account failed to create order. | |
| 500 | OperationFailed.AccessTunnelId | AccessTunnelId param do operation failed. | |
| 500 | OperationFailed.EnhancedCheckInventory | The NAT gateway in the current zone is not in service, or the resource inventory is insufficient. | |
| 404 | InvalidRegionId.NotFound | The specified RegionId does not exist in our records. | |
| 404 | InvalidVpcId.NotFound | Specified value of VpcId is not found in our record. | |
| 404 | InvalidZoneId.NotFound | Specified value of ZoneId is not exists. | |
| 404 | VPC_ONLY_CAN_CREATE_ONE_NAT_GATEWAY | NatGateway in one vpc support only one. | |
| 404 | OperationFailed.CrateEntryTimeOut | Operation failed because create custom routeEntry timeout. | |
| 404 | Forbidden.CreateSpecialSpecNatGateway | You are not authorized to create special spec nat gateway. | |
| 404 | UnsupportedZoneForFwNat | The zone is unsupported for FW NAT. |
完全なリストについては、「エラーコード」をご参照ください。
変更履歴
完全なリストについては、「変更履歴」をご参照ください。