Class: AWSCDK::EC2::CfnSubnetProps

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

Overview

Properties for defining a CfnSubnet.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(vpc_id:, assign_ipv6_address_on_creation: nil, availability_zone: nil, availability_zone_id: nil, cidr_block: nil, enable_dns64: nil, enable_lni_at_device_index: nil, ipv4_ipam_pool_id: nil, ipv4_netmask_length: nil, ipv6_cidr_block: nil, ipv6_ipam_pool_id: nil, ipv6_native: nil, ipv6_netmask_length: nil, map_public_ip_on_launch: nil, outpost_arn: nil, private_dns_name_options_on_launch: nil, tags: nil) ⇒ CfnSubnetProps

Returns a new instance of CfnSubnetProps.

Parameters:

  • vpc_id (String, AWSCDK::Interfaces::AWSEC2::IVPCRef)

    The ID of the VPC the subnet is in.

  • assign_ipv6_address_on_creation (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Indicates whether a network interface created in this subnet receives an IPv6 address. The default value is false .

  • availability_zone (String, nil) (defaults to: nil)

    The Availability Zone of the subnet.

  • availability_zone_id (String, nil) (defaults to: nil)

    The AZ ID of the subnet.

  • cidr_block (String, nil) (defaults to: nil)

    The IPv4 CIDR block assigned to the subnet.

  • enable_dns64 (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.

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

    Indicates the device position for local network interfaces in this subnet.

  • ipv4_ipam_pool_id (String, nil) (defaults to: nil)

    An IPv4 IPAM pool ID for the subnet.

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

    An IPv4 netmask length for the subnet.

  • ipv6_cidr_block (String, nil) (defaults to: nil)

    The IPv6 CIDR block.

  • ipv6_ipam_pool_id (String, nil) (defaults to: nil)

    An IPv6 IPAM pool ID for the subnet.

  • ipv6_native (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Indicates whether this is an IPv6 only subnet.

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

    An IPv6 netmask length for the subnet.

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

    Indicates whether instances launched in this subnet receive a public IPv4 address. The default value is false .

  • outpost_arn (String, nil) (defaults to: nil)

    The Amazon Resource Name (ARN) of the Outpost.

  • private_dns_name_options_on_launch (Object, nil) (defaults to: nil)

    The hostname type for EC2 instances launched into this subnet and how DNS A and AAAA record queries to the instances should be handled.

  • tags (Array<AWSCDK::CfnTag>, nil) (defaults to: nil)

    Any tags assigned to the subnet.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'ec2/cfn_subnet_props.rb', line 26

def initialize(vpc_id:, assign_ipv6_address_on_creation: nil, availability_zone: nil, availability_zone_id: nil, cidr_block: nil, enable_dns64: nil, enable_lni_at_device_index: nil, ipv4_ipam_pool_id: nil, ipv4_netmask_length: nil, ipv6_cidr_block: nil, ipv6_ipam_pool_id: nil, ipv6_native: nil, ipv6_netmask_length: nil, map_public_ip_on_launch: nil, outpost_arn: nil, private_dns_name_options_on_launch: nil, tags: nil)
  @vpc_id = vpc_id
  Jsii::Type.check_type(@vpc_id, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoic3RyaW5nIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19lYzIuSVZQQ1JlZiJ9XX19")), "vpcId")
  @assign_ipv6_address_on_creation = assign_ipv6_address_on_creation
  Jsii::Type.check_type(@assign_ipv6_address_on_creation, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "assignIpv6AddressOnCreation") unless @assign_ipv6_address_on_creation.nil?
  @availability_zone = availability_zone
  Jsii::Type.check_type(@availability_zone, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "availabilityZone") unless @availability_zone.nil?
  @availability_zone_id = availability_zone_id
  Jsii::Type.check_type(@availability_zone_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "availabilityZoneId") unless @availability_zone_id.nil?
  @cidr_block = cidr_block
  Jsii::Type.check_type(@cidr_block, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "cidrBlock") unless @cidr_block.nil?
  @enable_dns64 = enable_dns64
  Jsii::Type.check_type(@enable_dns64, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "enableDns64") unless @enable_dns64.nil?
  @enable_lni_at_device_index = enable_lni_at_device_index
  Jsii::Type.check_type(@enable_lni_at_device_index, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "enableLniAtDeviceIndex") unless @enable_lni_at_device_index.nil?
  @ipv4_ipam_pool_id = ipv4_ipam_pool_id
  Jsii::Type.check_type(@ipv4_ipam_pool_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "ipv4IpamPoolId") unless @ipv4_ipam_pool_id.nil?
  @ipv4_netmask_length = ipv4_netmask_length
  Jsii::Type.check_type(@ipv4_netmask_length, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "ipv4NetmaskLength") unless @ipv4_netmask_length.nil?
  @ipv6_cidr_block = ipv6_cidr_block
  Jsii::Type.check_type(@ipv6_cidr_block, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "ipv6CidrBlock") unless @ipv6_cidr_block.nil?
  @ipv6_ipam_pool_id = ipv6_ipam_pool_id
  Jsii::Type.check_type(@ipv6_ipam_pool_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "ipv6IpamPoolId") unless @ipv6_ipam_pool_id.nil?
  @ipv6_native = ipv6_native
  Jsii::Type.check_type(@ipv6_native, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "ipv6Native") unless @ipv6_native.nil?
  @ipv6_netmask_length = ipv6_netmask_length
  Jsii::Type.check_type(@ipv6_netmask_length, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "ipv6NetmaskLength") unless @ipv6_netmask_length.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("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "mapPublicIpOnLaunch") unless @map_public_ip_on_launch.nil?
  @outpost_arn = outpost_arn
  Jsii::Type.check_type(@outpost_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "outpostArn") unless @outpost_arn.nil?
  @private_dns_name_options_on_launch = private_dns_name_options_on_launch
  Jsii::Type.check_type(@private_dns_name_options_on_launch, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "privateDnsNameOptionsOnLaunch") unless @private_dns_name_options_on_launch.nil?
  @tags = tags.is_a?(Array) ? tags.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CfnTag.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : tags
  Jsii::Type.check_type(@tags, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLkNmblRhZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "tags") unless @tags.nil?
end

Instance Attribute Details

#assign_ipv6_address_on_creationBoolean, ... (readonly)

Indicates whether a network interface created in this subnet receives an IPv6 address. The default value is false .

If you specify AssignIpv6AddressOnCreation , you must also specify an IPv6 CIDR block.



76
77
78
# File 'ec2/cfn_subnet_props.rb', line 76

def assign_ipv6_address_on_creation
  @assign_ipv6_address_on_creation
end

#availability_zoneString? (readonly)

The Availability Zone of the subnet.

If you update this property, you must also update the CidrBlock property.



83
84
85
# File 'ec2/cfn_subnet_props.rb', line 83

def availability_zone
  @availability_zone
end

#availability_zone_idString? (readonly)

The AZ ID of the subnet.



88
89
90
# File 'ec2/cfn_subnet_props.rb', line 88

def availability_zone_id
  @availability_zone_id
end

#cidr_blockString? (readonly)

The IPv4 CIDR block assigned to the subnet.

If you update this property, we create a new subnet, and then delete the existing one.



95
96
97
# File 'ec2/cfn_subnet_props.rb', line 95

def cidr_block
  @cidr_block
end

#enable_dns64Boolean, ... (readonly)

Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.

You must first configure a NAT gateway in a public subnet (separate from the subnet containing the IPv6-only workloads). For example, the subnet containing the NAT gateway should have a 0.0.0.0/0 route pointing to the internet gateway. For more information, see Configure DNS64 and NAT64 in the Amazon Virtual Private Cloud User Guide .



102
103
104
# File 'ec2/cfn_subnet_props.rb', line 102

def enable_dns64
  @enable_dns64
end

#enable_lni_at_device_indexNumeric? (readonly)

Indicates the device position for local network interfaces in this subnet.

For example, 1 indicates local network interfaces in this subnet are the secondary network interface (eth1).



109
110
111
# File 'ec2/cfn_subnet_props.rb', line 109

def enable_lni_at_device_index
  @enable_lni_at_device_index
end

#ipv4_ipam_pool_idString? (readonly)

An IPv4 IPAM pool ID for the subnet.



114
115
116
# File 'ec2/cfn_subnet_props.rb', line 114

def ipv4_ipam_pool_id
  @ipv4_ipam_pool_id
end

#ipv4_netmask_lengthNumeric? (readonly)

An IPv4 netmask length for the subnet.



119
120
121
# File 'ec2/cfn_subnet_props.rb', line 119

def ipv4_netmask_length
  @ipv4_netmask_length
end

#ipv6_cidr_blockString? (readonly)

The IPv6 CIDR block.

If you specify AssignIpv6AddressOnCreation , you must also specify an IPv6 CIDR block.



126
127
128
# File 'ec2/cfn_subnet_props.rb', line 126

def ipv6_cidr_block
  @ipv6_cidr_block
end

#ipv6_ipam_pool_idString? (readonly)

An IPv6 IPAM pool ID for the subnet.



131
132
133
# File 'ec2/cfn_subnet_props.rb', line 131

def ipv6_ipam_pool_id
  @ipv6_ipam_pool_id
end

#ipv6_nativeBoolean, ... (readonly)

Indicates whether this is an IPv6 only subnet.

For more information, see Subnet basics in the Amazon Virtual Private Cloud User Guide .



138
139
140
# File 'ec2/cfn_subnet_props.rb', line 138

def ipv6_native
  @ipv6_native
end

#ipv6_netmask_lengthNumeric? (readonly)

An IPv6 netmask length for the subnet.



143
144
145
# File 'ec2/cfn_subnet_props.rb', line 143

def ipv6_netmask_length
  @ipv6_netmask_length
end

#map_public_ip_on_launchBoolean, ... (readonly)

Indicates whether instances launched in this subnet receive a public IPv4 address. The default value is false .

AWS charges for all public IPv4 addresses, including public IPv4 addresses associated with running instances and Elastic IP addresses. For more information, see the Public IPv4 Address tab on the VPC pricing page .



150
151
152
# File 'ec2/cfn_subnet_props.rb', line 150

def map_public_ip_on_launch
  @map_public_ip_on_launch
end

#outpost_arnString? (readonly)

The Amazon Resource Name (ARN) of the Outpost.



155
156
157
# File 'ec2/cfn_subnet_props.rb', line 155

def outpost_arn
  @outpost_arn
end

#private_dns_name_options_on_launchObject? (readonly)

The hostname type for EC2 instances launched into this subnet and how DNS A and AAAA record queries to the instances should be handled.

For more information, see Amazon EC2 instance hostname types in the Amazon Elastic Compute Cloud User Guide .

Available options:

  • EnableResourceNameDnsAAAARecord (true | false)
  • EnableResourceNameDnsARecord (true | false)
  • HostnameType (ip-name | resource-name)


168
169
170
# File 'ec2/cfn_subnet_props.rb', line 168

def private_dns_name_options_on_launch
  @private_dns_name_options_on_launch
end

#tagsArray<AWSCDK::CfnTag>? (readonly)

Any tags assigned to the subnet.



173
174
175
# File 'ec2/cfn_subnet_props.rb', line 173

def tags
  @tags
end

#vpc_idString, AWSCDK::Interfaces::AWSEC2::IVPCRef (readonly)

The ID of the VPC the subnet is in.

If you update this property, you must also update the CidrBlock property.



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

def vpc_id
  @vpc_id
end

Class Method Details

.jsii_propertiesObject



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'ec2/cfn_subnet_props.rb', line 175

def self.jsii_properties
  {
    :vpc_id => "vpcId",
    :assign_ipv6_address_on_creation => "assignIpv6AddressOnCreation",
    :availability_zone => "availabilityZone",
    :availability_zone_id => "availabilityZoneId",
    :cidr_block => "cidrBlock",
    :enable_dns64 => "enableDns64",
    :enable_lni_at_device_index => "enableLniAtDeviceIndex",
    :ipv4_ipam_pool_id => "ipv4IpamPoolId",
    :ipv4_netmask_length => "ipv4NetmaskLength",
    :ipv6_cidr_block => "ipv6CidrBlock",
    :ipv6_ipam_pool_id => "ipv6IpamPoolId",
    :ipv6_native => "ipv6Native",
    :ipv6_netmask_length => "ipv6NetmaskLength",
    :map_public_ip_on_launch => "mapPublicIpOnLaunch",
    :outpost_arn => "outpostArn",
    :private_dns_name_options_on_launch => "privateDnsNameOptionsOnLaunch",
    :tags => "tags",
  }
end

Instance Method Details

#to_jsiiObject



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'ec2/cfn_subnet_props.rb', line 197

def to_jsii
  result = {}
  result.merge!({
    "vpcId" => @vpc_id,
    "assignIpv6AddressOnCreation" => @assign_ipv6_address_on_creation,
    "availabilityZone" => @availability_zone,
    "availabilityZoneId" => @availability_zone_id,
    "cidrBlock" => @cidr_block,
    "enableDns64" => @enable_dns64,
    "enableLniAtDeviceIndex" => @enable_lni_at_device_index,
    "ipv4IpamPoolId" => @ipv4_ipam_pool_id,
    "ipv4NetmaskLength" => @ipv4_netmask_length,
    "ipv6CidrBlock" => @ipv6_cidr_block,
    "ipv6IpamPoolId" => @ipv6_ipam_pool_id,
    "ipv6Native" => @ipv6_native,
    "ipv6NetmaskLength" => @ipv6_netmask_length,
    "mapPublicIpOnLaunch" => @map_public_ip_on_launch,
    "outpostArn" => @outpost_arn,
    "privateDnsNameOptionsOnLaunch" => @private_dns_name_options_on_launch,
    "tags" => @tags,
  })
  result.compact
end