Updated on 2023-12-13 GMT+08:00

NAT.SNatRule

Element Description

The NAT.SNatRule element is used to create a source NAT rule, which specifies the network segment for accessing the external network.

Element Properties

Table 1 Property Description

Property

Required

Descripiton

subnetId

Yes

ID of the Subnet to which the SNatRule belongs

Type: HuaweiCloud.VPC.Subnet.Id

Value Constraint: The value must satisfy the UUID rule and support a maximum of 64 characters.

Suggestion: Use the get_input function to pass this parameter. Its value can then be automatically selected when you create a stack on the AOS console. Connect to a subnet object and use the get_reference function to the ID of the newly created subnet.

floatingIpId

Yes

User EIP ID

Type: HuaweiCloud.VPC.EIP.Id

Value Description: Supports the ID of an existing or new public elastic IP address.

Suggestion: 1. Use the get_attribute function to obtain the ID of the elastic public IP address created by the template. 2. On the public elastic IP address page (https://console.huaweicloud.com/vpc?&locale=en-us), obtain the ID of the created IP address.

natGatewayId

Yes

ID of the NatGateWay

Type: string

Value Description: Obtains the natgateway ID from the NAT service or put snatrule in the natgateway to automatically establish the dependency relationship.

Value Constraint: The value must satisfy the UUID rule and support a maximum of 64 characters.

Suggestion: Use the get_input function to pass this parameter. Its value can then be automatically selected when you create a stack on the AOS console. Use the get_reference function to obtain the NatGateWay ID.

Relationships Between Elements

Table 2 Relationship description

Description

Target

Connected

VPC.Subnet

ContainedIn

NAT.Instance

Connected

VPC.EIP

Return Value

Property

Type

Description

refID

string

NAT sNatRule ID

Blueprint Example

tosca_definitions_version: huaweicloud_tosca_version_1_0
node_templates:
  nat:
    type: HuaweiCloud.NAT.Instance
    properties:
      subnetId:
        get_input: nat_subnetId
      flavor: small
      vpcId:
        get_input: nat_vpcId
      name:
        get_input: nat_name
  snatrule:
    type: HuaweiCloud.NAT.SNatRule
    properties:
      subnetId:
        get_input: snatrule_subnetId
      floatingIpId:
        get_input: snatrule_floatingIpId
      natGatewayId:
        get_reference: nat
    requirements:
      - natGatewayId:
          node: nat
inputs:
  nat_subnetId:
    description: ID of the subnet to which the NAT gateway belongs
    label: ''
  nat_vpcId:
    description: ID of the VPC to which the NAT gateway belongs
    label: ''
  nat_name:
    description: NAT name
    label: ''
  snatrule_subnetId:
    description: ID of the subnet to which the source NAT rule belongs
    label: ''
  snatrule_floatingIpId:
    description: ID of the user's elastic IP address
    label: ''