Class: AWSCDK::EC2::NatProvider

Inherits:
Jsii::Object
  • Object
show all
Defined in:
ec2/nat_provider.rb

Overview

NAT providers.

Determines what type of NAT provider to create, either NAT gateways or NAT instance.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNatProvider

Returns a new instance of NatProvider.



11
12
13
# File 'ec2/nat_provider.rb', line 11

def initialize
  Jsii::Object.instance_method(:initialize).bind(self).call
end

Class Method Details

.gateway(props = nil) ⇒ AWSCDK::EC2::NatProvider

Use NAT Gateways to provide NAT services for your VPC.

NAT gateways are managed by AWS.

Parameters:

Returns:

  • (AWSCDK::EC2::NatProvider)

See Also:



30
31
32
33
34
# File 'ec2/nat_provider.rb', line 30

def self.gateway(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::EC2::NatGatewayProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLk5hdEdhdGV3YXlQcm9wcyJ9")), "props") unless props.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ec2.NatProvider", "gateway", [props])
end

.instance(props) ⇒ AWSCDK::EC2::NatInstanceProvider

Deprecated.

use instanceV2. 'instance' is deprecated since NatInstanceProvider uses a instance image that has reached EOL on Dec 31 2023

Use NAT instances to provide NAT services for your VPC.

NAT instances are managed by you, but in return allow more configuration.

Be aware that instances created using this provider will not be automatically replaced if they are stopped for any reason. You should implement your own NatProvider based on AutoScaling groups if you need that.



48
49
50
51
52
# File 'ec2/nat_provider.rb', line 48

def self.instance(props)
  props = props.is_a?(Hash) ? ::AWSCDK::EC2::NatInstanceProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLk5hdEluc3RhbmNlUHJvcHMifQ==")), "props")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ec2.NatProvider", "instance", [props])
end

.instance_v2(props) ⇒ AWSCDK::EC2::NatInstanceProviderV2

Use NAT instances to provide NAT services for your VPC.

NAT instances are managed by you, but in return allow more configuration.

Be aware that instances created using this provider will not be automatically replaced if they are stopped for any reason. You should implement your own NatProvider based on AutoScaling groups if you need that.



65
66
67
68
69
# File 'ec2/nat_provider.rb', line 65

def self.instance_v2(props)
  props = props.is_a?(Hash) ? ::AWSCDK::EC2::NatInstanceProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLk5hdEluc3RhbmNlUHJvcHMifQ==")), "props")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ec2.NatProvider", "instanceV2", [props])
end

.jsii_overridable_methodsObject



15
16
17
18
19
20
21
# File 'ec2/nat_provider.rb', line 15

def self.jsii_overridable_methods
  {
    :configured_gateways => { kind: :property, name: "configuredGateways", is_optional: false },
    :configure_nat => { kind: :method, name: "configureNat", is_optional: false },
    :configure_subnet => { kind: :method, name: "configureSubnet", is_optional: false },
  }
end

Instance Method Details

#configure_nat(options) ⇒ void

This method returns an undefined value.

Called by the VPC to configure NAT.

Don't call this directly, the VPC will call it automatically.

Parameters:



84
85
86
87
88
# File 'ec2/nat_provider.rb', line 84

def configure_nat(options)
  options = options.is_a?(Hash) ? ::AWSCDK::EC2::ConfigureNatOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNvbmZpZ3VyZU5hdE9wdGlvbnMifQ==")), "options")
  jsii_call_method("configureNat", [options])
end

#configure_subnet(subnet) ⇒ void

This method returns an undefined value.

Configures subnet with the gateway.

Don't call this directly, the VPC will call it automatically.

Parameters:



96
97
98
99
# File 'ec2/nat_provider.rb', line 96

def configure_subnet(subnet)
  Jsii::Type.check_type(subnet, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlByaXZhdGVTdWJuZXQifQ==")), "subnet")
  jsii_call_method("configureSubnet", [subnet])
end

#configured_gatewaysArray<AWSCDK::EC2::GatewayConfig>

Return list of gateways spawned by the provider.

Returns:



74
75
76
# File 'ec2/nat_provider.rb', line 74

def configured_gateways()
  jsii_get_property("configuredGateways")
end