Class: AWSCDK::EC2::SubnetConfiguration

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

Overview

Specify configuration parameters for a single subnet group in a VPC.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, subnet_type:, cidr_mask: nil, ipv6_assign_address_on_creation: nil, map_public_ip_on_launch: nil, reserved: nil) ⇒ SubnetConfiguration

Returns a new instance of SubnetConfiguration.

Parameters:

  • name (String)

    Logical name for the subnet group.

  • subnet_type (AWSCDK::EC2::SubnetType)

    The type of Subnet to configure.

  • cidr_mask (Numeric, nil) (defaults to: nil)

    The number of leading 1 bits in the routing mask.

  • ipv6_assign_address_on_creation (Boolean, nil) (defaults to: nil)

    This property is specific to dual stack VPCs.

  • map_public_ip_on_launch (Boolean, nil) (defaults to: nil)

    Controls if a public IPv4 address is associated to an instance at launch.

  • reserved (Boolean, nil) (defaults to: nil)

    Controls if subnet IP space needs to be reserved.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'ec2/subnet_configuration.rb', line 13

def initialize(name:, subnet_type:, cidr_mask: nil, ipv6_assign_address_on_creation: nil, map_public_ip_on_launch: nil, reserved: nil)
  @name = name
  Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name")
  @subnet_type = subnet_type
  Jsii::Type.check_type(@subnet_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlN1Ym5ldFR5cGUifQ==")), "subnetType")
  @cidr_mask = cidr_mask
  Jsii::Type.check_type(@cidr_mask, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "cidrMask") unless @cidr_mask.nil?
  @ipv6_assign_address_on_creation = ipv6_assign_address_on_creation
  Jsii::Type.check_type(@ipv6_assign_address_on_creation, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "ipv6AssignAddressOnCreation") unless @ipv6_assign_address_on_creation.nil?
  @map_public_ip_on_launch = map_public_ip_on_launch
  Jsii::Type.check_type(@map_public_ip_on_launch, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "mapPublicIpOnLaunch") unless @map_public_ip_on_launch.nil?
  @reserved = reserved
  Jsii::Type.check_type(@reserved, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "reserved") unless @reserved.nil?
end

Instance Attribute Details

#cidr_maskNumeric? (readonly)

Note:

Default: - Available IP space is evenly divided across subnets.

The number of leading 1 bits in the routing mask.

The number of available IP addresses in each subnet of this group will be equal to 2^(32 - cidrMask) - 2.

Valid values are 16--28.

Note this is specific to IPv4 addresses.

Returns:

  • (Numeric, nil)


53
54
55
# File 'ec2/subnet_configuration.rb', line 53

def cidr_mask
  @cidr_mask
end

#ipv6_assign_address_on_creationBoolean? (readonly)

Note:

Default: true

This property is specific to dual stack VPCs.

If set to false, then an IPv6 address will not be automatically assigned.

Note this is specific to IPv6 addresses.

Returns:

  • (Boolean, nil)


62
63
64
# File 'ec2/subnet_configuration.rb', line 62

def ipv6_assign_address_on_creation
  @ipv6_assign_address_on_creation
end

#map_public_ip_on_launchBoolean? (readonly)

Note:

Default: true in Subnet.Public of IPV4_ONLY VPCs, false otherwise

Controls if a public IPv4 address is associated to an instance at launch.

Note this is specific to IPv4 addresses.

Returns:

  • (Boolean, nil)


69
70
71
# File 'ec2/subnet_configuration.rb', line 69

def map_public_ip_on_launch
  @map_public_ip_on_launch
end

#nameString (readonly)

Logical name for the subnet group.

This name can be used when selecting VPC subnets to distinguish between different subnet groups of the same type.

Returns:

  • (String)


34
35
36
# File 'ec2/subnet_configuration.rb', line 34

def name
  @name
end

#reservedBoolean? (readonly)

Note:

Default: false

Controls if subnet IP space needs to be reserved.

When true, the IP space for the subnet is reserved but no actual resources are provisioned. This space is only dependent on the number of availability zones and on cidr_mask - all other subnet properties are ignored.

Returns:

  • (Boolean, nil)


79
80
81
# File 'ec2/subnet_configuration.rb', line 79

def reserved
  @reserved
end

#subnet_typeAWSCDK::EC2::SubnetType (readonly)

The type of Subnet to configure.

The Subnet type will control the ability to route and connect to the Internet.



41
42
43
# File 'ec2/subnet_configuration.rb', line 41

def subnet_type
  @subnet_type
end

Class Method Details

.jsii_propertiesObject



81
82
83
84
85
86
87
88
89
90
# File 'ec2/subnet_configuration.rb', line 81

def self.jsii_properties
  {
    :name => "name",
    :subnet_type => "subnetType",
    :cidr_mask => "cidrMask",
    :ipv6_assign_address_on_creation => "ipv6AssignAddressOnCreation",
    :map_public_ip_on_launch => "mapPublicIpOnLaunch",
    :reserved => "reserved",
  }
end

Instance Method Details

#to_jsiiObject



92
93
94
95
96
97
98
99
100
101
102
103
# File 'ec2/subnet_configuration.rb', line 92

def to_jsii
  result = {}
  result.merge!({
    "name" => @name,
    "subnetType" => @subnet_type,
    "cidrMask" => @cidr_mask,
    "ipv6AssignAddressOnCreation" => @ipv6_assign_address_on_creation,
    "mapPublicIpOnLaunch" => @map_public_ip_on_launch,
    "reserved" => @reserved,
  })
  result.compact
end