published on Thursday, Apr 23, 2026 by Volcengine
published on Thursday, Apr 23, 2026 by Volcengine
When multiple cloud server instances in a private network need to access the public network, you can use SNAT rules of the public NAT gateway to save public IPs and avoid exposing cloud server IPs directly to the public network for secure, convenient, and efficient access. SNAT rules support four granularities: private network, subnet, cloud server, and custom network segment. Configure flexibly based on your business needs.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as volcenginecc from "@volcengine/pulumi-volcenginecc";
const natGatewaySnatentryDemo = new volcenginecc.natgateway.Snatentry("NatGatewaySnatentryDemo", {
natGatewayId: "ngw-2pc28yhdpbx8g227qo1xxxxx",
eipId: "eip-iivdtssgbdog74o8cuxxxxx,eip-btbv1pk36g3k5h0b2vxxxxx",
snatEntryName: "test",
sourceCidr: "0.0.0.0/0",
});
import pulumi
import pulumi_volcenginecc as volcenginecc
nat_gateway_snatentry_demo = volcenginecc.natgateway.Snatentry("NatGatewaySnatentryDemo",
nat_gateway_id="ngw-2pc28yhdpbx8g227qo1xxxxx",
eip_id="eip-iivdtssgbdog74o8cuxxxxx,eip-btbv1pk36g3k5h0b2vxxxxx",
snat_entry_name="test",
source_cidr="0.0.0.0/0")
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/volcengine/pulumi-volcenginecc/sdk/go/volcenginecc/natgateway"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := natgateway.NewSnatentry(ctx, "NatGatewaySnatentryDemo", &natgateway.SnatentryArgs{
NatGatewayId: pulumi.String("ngw-2pc28yhdpbx8g227qo1xxxxx"),
EipId: pulumi.String("eip-iivdtssgbdog74o8cuxxxxx,eip-btbv1pk36g3k5h0b2vxxxxx"),
SnatEntryName: pulumi.String("test"),
SourceCidr: pulumi.String("0.0.0.0/0"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Volcenginecc = Volcengine.Pulumi.Volcenginecc;
return await Deployment.RunAsync(() =>
{
var natGatewaySnatentryDemo = new Volcenginecc.Natgateway.Snatentry("NatGatewaySnatentryDemo", new()
{
NatGatewayId = "ngw-2pc28yhdpbx8g227qo1xxxxx",
EipId = "eip-iivdtssgbdog74o8cuxxxxx,eip-btbv1pk36g3k5h0b2vxxxxx",
SnatEntryName = "test",
SourceCidr = "0.0.0.0/0",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.volcengine.volcenginecc.natgateway.Snatentry;
import com.volcengine.volcenginecc.natgateway.SnatentryArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var natGatewaySnatentryDemo = new Snatentry("natGatewaySnatentryDemo", SnatentryArgs.builder()
.natGatewayId("ngw-2pc28yhdpbx8g227qo1xxxxx")
.eipId("eip-iivdtssgbdog74o8cuxxxxx,eip-btbv1pk36g3k5h0b2vxxxxx")
.snatEntryName("test")
.sourceCidr("0.0.0.0/0")
.build());
}
}
resources:
natGatewaySnatentryDemo:
type: volcenginecc:natgateway:Snatentry
name: NatGatewaySnatentryDemo
properties:
natGatewayId: ngw-2pc28yhdpbx8g227qo1xxxxx
eipId: eip-iivdtssgbdog74o8cuxxxxx,eip-btbv1pk36g3k5h0b2vxxxxx
snatEntryName: test
sourceCidr: 0.0.0.0/0
Create Snatentry Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Snatentry(name: string, args: SnatentryArgs, opts?: CustomResourceOptions);@overload
def Snatentry(resource_name: str,
args: SnatentryArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Snatentry(resource_name: str,
opts: Optional[ResourceOptions] = None,
nat_gateway_id: Optional[str] = None,
eip_id: Optional[str] = None,
nat_ip_id: Optional[str] = None,
snat_entry_name: Optional[str] = None,
source_cidr: Optional[str] = None,
subnet_id: Optional[str] = None)func NewSnatentry(ctx *Context, name string, args SnatentryArgs, opts ...ResourceOption) (*Snatentry, error)public Snatentry(string name, SnatentryArgs args, CustomResourceOptions? opts = null)
public Snatentry(String name, SnatentryArgs args)
public Snatentry(String name, SnatentryArgs args, CustomResourceOptions options)
type: volcenginecc:natgateway:Snatentry
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args SnatentryArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args SnatentryArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args SnatentryArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SnatentryArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SnatentryArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var snatentryResource = new Volcenginecc.Natgateway.Snatentry("snatentryResource", new()
{
NatGatewayId = "string",
EipId = "string",
NatIpId = "string",
SnatEntryName = "string",
SourceCidr = "string",
SubnetId = "string",
});
example, err := natgateway.NewSnatentry(ctx, "snatentryResource", &natgateway.SnatentryArgs{
NatGatewayId: pulumi.String("string"),
EipId: pulumi.String("string"),
NatIpId: pulumi.String("string"),
SnatEntryName: pulumi.String("string"),
SourceCidr: pulumi.String("string"),
SubnetId: pulumi.String("string"),
})
var snatentryResource = new Snatentry("snatentryResource", SnatentryArgs.builder()
.natGatewayId("string")
.eipId("string")
.natIpId("string")
.snatEntryName("string")
.sourceCidr("string")
.subnetId("string")
.build());
snatentry_resource = volcenginecc.natgateway.Snatentry("snatentryResource",
nat_gateway_id="string",
eip_id="string",
nat_ip_id="string",
snat_entry_name="string",
source_cidr="string",
subnet_id="string")
const snatentryResource = new volcenginecc.natgateway.Snatentry("snatentryResource", {
natGatewayId: "string",
eipId: "string",
natIpId: "string",
snatEntryName: "string",
sourceCidr: "string",
subnetId: "string",
});
type: volcenginecc:natgateway:Snatentry
properties:
eipId: string
natGatewayId: string
natIpId: string
snatEntryName: string
sourceCidr: string
subnetId: string
Snatentry Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Snatentry resource accepts the following input properties:
- Nat
Gateway stringId - ID of the NAT gateway associated with the SNAT rule
- Eip
Id string - ID of the public IP associated with the SNAT rule. Returns the ID for a single public IP. Returns IDs for multiple public IPs.
- Nat
Ip stringId - ID of the transit IP for the private NAT gateway
- Snat
Entry stringName - Name of the SNAT rule
- Source
Cidr string - Network segment corresponding to the SNAT rule
- Subnet
Id string - ID of the subnet associated with the SNAT rule
- Nat
Gateway stringId - ID of the NAT gateway associated with the SNAT rule
- Eip
Id string - ID of the public IP associated with the SNAT rule. Returns the ID for a single public IP. Returns IDs for multiple public IPs.
- Nat
Ip stringId - ID of the transit IP for the private NAT gateway
- Snat
Entry stringName - Name of the SNAT rule
- Source
Cidr string - Network segment corresponding to the SNAT rule
- Subnet
Id string - ID of the subnet associated with the SNAT rule
- nat
Gateway StringId - ID of the NAT gateway associated with the SNAT rule
- eip
Id String - ID of the public IP associated with the SNAT rule. Returns the ID for a single public IP. Returns IDs for multiple public IPs.
- nat
Ip StringId - ID of the transit IP for the private NAT gateway
- snat
Entry StringName - Name of the SNAT rule
- source
Cidr String - Network segment corresponding to the SNAT rule
- subnet
Id String - ID of the subnet associated with the SNAT rule
- nat
Gateway stringId - ID of the NAT gateway associated with the SNAT rule
- eip
Id string - ID of the public IP associated with the SNAT rule. Returns the ID for a single public IP. Returns IDs for multiple public IPs.
- nat
Ip stringId - ID of the transit IP for the private NAT gateway
- snat
Entry stringName - Name of the SNAT rule
- source
Cidr string - Network segment corresponding to the SNAT rule
- subnet
Id string - ID of the subnet associated with the SNAT rule
- nat_
gateway_ strid - ID of the NAT gateway associated with the SNAT rule
- eip_
id str - ID of the public IP associated with the SNAT rule. Returns the ID for a single public IP. Returns IDs for multiple public IPs.
- nat_
ip_ strid - ID of the transit IP for the private NAT gateway
- snat_
entry_ strname - Name of the SNAT rule
- source_
cidr str - Network segment corresponding to the SNAT rule
- subnet_
id str - ID of the subnet associated with the SNAT rule
- nat
Gateway StringId - ID of the NAT gateway associated with the SNAT rule
- eip
Id String - ID of the public IP associated with the SNAT rule. Returns the ID for a single public IP. Returns IDs for multiple public IPs.
- nat
Ip StringId - ID of the transit IP for the private NAT gateway
- snat
Entry StringName - Name of the SNAT rule
- source
Cidr String - Network segment corresponding to the SNAT rule
- subnet
Id String - ID of the subnet associated with the SNAT rule
Outputs
All input properties are implicitly available as output properties. Additionally, the Snatentry resource produces the following output properties:
- Eip
Address string - IP address of the public IP associated with the SNAT rule. Returns the IP address for a single public IP. Returns IP addresses for multiple public IPs.
- Id string
- The provider-assigned unique ID for this managed resource.
- Snat
Entry stringId - ID of the SNAT rule
- Status string
- Status of the SNAT rule. Creating: being created. Deleting: being deleted. Available: available.
- Eip
Address string - IP address of the public IP associated with the SNAT rule. Returns the IP address for a single public IP. Returns IP addresses for multiple public IPs.
- Id string
- The provider-assigned unique ID for this managed resource.
- Snat
Entry stringId - ID of the SNAT rule
- Status string
- Status of the SNAT rule. Creating: being created. Deleting: being deleted. Available: available.
- eip
Address String - IP address of the public IP associated with the SNAT rule. Returns the IP address for a single public IP. Returns IP addresses for multiple public IPs.
- id String
- The provider-assigned unique ID for this managed resource.
- snat
Entry StringId - ID of the SNAT rule
- status String
- Status of the SNAT rule. Creating: being created. Deleting: being deleted. Available: available.
- eip
Address string - IP address of the public IP associated with the SNAT rule. Returns the IP address for a single public IP. Returns IP addresses for multiple public IPs.
- id string
- The provider-assigned unique ID for this managed resource.
- snat
Entry stringId - ID of the SNAT rule
- status string
- Status of the SNAT rule. Creating: being created. Deleting: being deleted. Available: available.
- eip_
address str - IP address of the public IP associated with the SNAT rule. Returns the IP address for a single public IP. Returns IP addresses for multiple public IPs.
- id str
- The provider-assigned unique ID for this managed resource.
- snat_
entry_ strid - ID of the SNAT rule
- status str
- Status of the SNAT rule. Creating: being created. Deleting: being deleted. Available: available.
- eip
Address String - IP address of the public IP associated with the SNAT rule. Returns the IP address for a single public IP. Returns IP addresses for multiple public IPs.
- id String
- The provider-assigned unique ID for this managed resource.
- snat
Entry StringId - ID of the SNAT rule
- status String
- Status of the SNAT rule. Creating: being created. Deleting: being deleted. Available: available.
Look up Existing Snatentry Resource
Get an existing Snatentry resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: SnatentryState, opts?: CustomResourceOptions): Snatentry@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
eip_address: Optional[str] = None,
eip_id: Optional[str] = None,
nat_gateway_id: Optional[str] = None,
nat_ip_id: Optional[str] = None,
snat_entry_id: Optional[str] = None,
snat_entry_name: Optional[str] = None,
source_cidr: Optional[str] = None,
status: Optional[str] = None,
subnet_id: Optional[str] = None) -> Snatentryfunc GetSnatentry(ctx *Context, name string, id IDInput, state *SnatentryState, opts ...ResourceOption) (*Snatentry, error)public static Snatentry Get(string name, Input<string> id, SnatentryState? state, CustomResourceOptions? opts = null)public static Snatentry get(String name, Output<String> id, SnatentryState state, CustomResourceOptions options)resources: _: type: volcenginecc:natgateway:Snatentry get: id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Eip
Address string - IP address of the public IP associated with the SNAT rule. Returns the IP address for a single public IP. Returns IP addresses for multiple public IPs.
- Eip
Id string - ID of the public IP associated with the SNAT rule. Returns the ID for a single public IP. Returns IDs for multiple public IPs.
- Nat
Gateway stringId - ID of the NAT gateway associated with the SNAT rule
- Nat
Ip stringId - ID of the transit IP for the private NAT gateway
- Snat
Entry stringId - ID of the SNAT rule
- Snat
Entry stringName - Name of the SNAT rule
- Source
Cidr string - Network segment corresponding to the SNAT rule
- Status string
- Status of the SNAT rule. Creating: being created. Deleting: being deleted. Available: available.
- Subnet
Id string - ID of the subnet associated with the SNAT rule
- Eip
Address string - IP address of the public IP associated with the SNAT rule. Returns the IP address for a single public IP. Returns IP addresses for multiple public IPs.
- Eip
Id string - ID of the public IP associated with the SNAT rule. Returns the ID for a single public IP. Returns IDs for multiple public IPs.
- Nat
Gateway stringId - ID of the NAT gateway associated with the SNAT rule
- Nat
Ip stringId - ID of the transit IP for the private NAT gateway
- Snat
Entry stringId - ID of the SNAT rule
- Snat
Entry stringName - Name of the SNAT rule
- Source
Cidr string - Network segment corresponding to the SNAT rule
- Status string
- Status of the SNAT rule. Creating: being created. Deleting: being deleted. Available: available.
- Subnet
Id string - ID of the subnet associated with the SNAT rule
- eip
Address String - IP address of the public IP associated with the SNAT rule. Returns the IP address for a single public IP. Returns IP addresses for multiple public IPs.
- eip
Id String - ID of the public IP associated with the SNAT rule. Returns the ID for a single public IP. Returns IDs for multiple public IPs.
- nat
Gateway StringId - ID of the NAT gateway associated with the SNAT rule
- nat
Ip StringId - ID of the transit IP for the private NAT gateway
- snat
Entry StringId - ID of the SNAT rule
- snat
Entry StringName - Name of the SNAT rule
- source
Cidr String - Network segment corresponding to the SNAT rule
- status String
- Status of the SNAT rule. Creating: being created. Deleting: being deleted. Available: available.
- subnet
Id String - ID of the subnet associated with the SNAT rule
- eip
Address string - IP address of the public IP associated with the SNAT rule. Returns the IP address for a single public IP. Returns IP addresses for multiple public IPs.
- eip
Id string - ID of the public IP associated with the SNAT rule. Returns the ID for a single public IP. Returns IDs for multiple public IPs.
- nat
Gateway stringId - ID of the NAT gateway associated with the SNAT rule
- nat
Ip stringId - ID of the transit IP for the private NAT gateway
- snat
Entry stringId - ID of the SNAT rule
- snat
Entry stringName - Name of the SNAT rule
- source
Cidr string - Network segment corresponding to the SNAT rule
- status string
- Status of the SNAT rule. Creating: being created. Deleting: being deleted. Available: available.
- subnet
Id string - ID of the subnet associated with the SNAT rule
- eip_
address str - IP address of the public IP associated with the SNAT rule. Returns the IP address for a single public IP. Returns IP addresses for multiple public IPs.
- eip_
id str - ID of the public IP associated with the SNAT rule. Returns the ID for a single public IP. Returns IDs for multiple public IPs.
- nat_
gateway_ strid - ID of the NAT gateway associated with the SNAT rule
- nat_
ip_ strid - ID of the transit IP for the private NAT gateway
- snat_
entry_ strid - ID of the SNAT rule
- snat_
entry_ strname - Name of the SNAT rule
- source_
cidr str - Network segment corresponding to the SNAT rule
- status str
- Status of the SNAT rule. Creating: being created. Deleting: being deleted. Available: available.
- subnet_
id str - ID of the subnet associated with the SNAT rule
- eip
Address String - IP address of the public IP associated with the SNAT rule. Returns the IP address for a single public IP. Returns IP addresses for multiple public IPs.
- eip
Id String - ID of the public IP associated with the SNAT rule. Returns the ID for a single public IP. Returns IDs for multiple public IPs.
- nat
Gateway StringId - ID of the NAT gateway associated with the SNAT rule
- nat
Ip StringId - ID of the transit IP for the private NAT gateway
- snat
Entry StringId - ID of the SNAT rule
- snat
Entry StringName - Name of the SNAT rule
- source
Cidr String - Network segment corresponding to the SNAT rule
- status String
- Status of the SNAT rule. Creating: being created. Deleting: being deleted. Available: available.
- subnet
Id String - ID of the subnet associated with the SNAT rule
Import
$ pulumi import volcenginecc:natgateway/snatentry:Snatentry example "snat_entry_id"
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- volcenginecc volcengine/pulumi-volcenginecc
- License
- MPL-2.0
- Notes
- This Pulumi package is based on the
volcengineccTerraform Provider.
published on Thursday, Apr 23, 2026 by Volcengine
