Class: AWSCDK::EC2::CfnInstance::NetworkInterfaceProperty

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

Overview

Specifies a network interface that is to be attached to an instance.

You can create a network interface when launching an instance. For an example, see the AWS::EC2::Instance examples .

Alternatively, you can attach an existing network interface when launching an instance. For an example, see the AWS::EC2:NetworkInterface examples .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(device_index:, associate_carrier_ip_address: nil, associate_public_ip_address: nil, delete_on_termination: nil, description: nil, ena_srd_specification: nil, group_set: nil, ipv6_address_count: nil, ipv6_addresses: nil, network_interface_id: nil, private_ip_address: nil, private_ip_addresses: nil, secondary_private_ip_address_count: nil, subnet_id: nil) ⇒ NetworkInterfaceProperty

Returns a new instance of NetworkInterfaceProperty.

Parameters:

  • device_index (String)

    The position of the network interface in the attachment order.

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

    Indicates whether to assign a carrier IP address to the network interface.

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

    Indicates whether to assign a public IPv4 address to an instance.

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

    Indicates whether the network interface is deleted when the instance is terminated.

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

    The description of the network interface.

  • ena_srd_specification (AWSCDK::IResolvable, AWSCDK::EC2::CfnInstance::EnaSrdSpecificationProperty, nil) (defaults to: nil)

    Configures ENA Express for UDP network traffic.

  • group_set (Array<String>, nil) (defaults to: nil)

    The IDs of the security groups for the network interface.

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

    A number of IPv6 addresses to assign to the network interface.

  • ipv6_addresses (AWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::EC2::CfnInstance::InstanceIpv6AddressProperty>, nil) (defaults to: nil)

    The IPv6 addresses to assign to the network interface.

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

    The ID of the network interface, when attaching an existing network interface.

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

    The private IPv4 address of the network interface.

  • private_ip_addresses (AWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::EC2::CfnInstance::PrivateIPAddressSpecificationProperty>, nil) (defaults to: nil)

    One or more private IPv4 addresses to assign to the network interface.

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

    The number of secondary private IPv4 addresses.

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

    The ID of the subnet associated with the network interface.



1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
# File 'ec2/cfn_instance.rb', line 1993

def initialize(device_index:, associate_carrier_ip_address: nil, associate_public_ip_address: nil, delete_on_termination: nil, description: nil, ena_srd_specification: nil, group_set: nil, ipv6_address_count: nil, ipv6_addresses: nil, network_interface_id: nil, private_ip_address: nil, private_ip_addresses: nil, secondary_private_ip_address_count: nil, subnet_id: nil)
  @device_index = device_index
  Jsii::Type.check_type(@device_index, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "deviceIndex")
  @associate_carrier_ip_address = associate_carrier_ip_address
  Jsii::Type.check_type(@associate_carrier_ip_address, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "associateCarrierIpAddress") unless @associate_carrier_ip_address.nil?
  @associate_public_ip_address = associate_public_ip_address
  Jsii::Type.check_type(@associate_public_ip_address, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "associatePublicIpAddress") unless @associate_public_ip_address.nil?
  @delete_on_termination = delete_on_termination
  Jsii::Type.check_type(@delete_on_termination, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "deleteOnTermination") unless @delete_on_termination.nil?
  @description = description
  Jsii::Type.check_type(@description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description") unless @description.nil?
  @ena_srd_specification = ena_srd_specification.is_a?(Hash) ? ::AWSCDK::EC2::CfnInstance::EnaSrdSpecificationProperty.new(**ena_srd_specification.transform_keys(&:to_sym)) : ena_srd_specification
  Jsii::Type.check_type(@ena_srd_specification, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuSW5zdGFuY2UuRW5hU3JkU3BlY2lmaWNhdGlvblByb3BlcnR5In1dfX0=")), "enaSrdSpecification") unless @ena_srd_specification.nil?
  @group_set = group_set
  Jsii::Type.check_type(@group_set, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "groupSet") unless @group_set.nil?
  @ipv6_address_count = ipv6_address_count
  Jsii::Type.check_type(@ipv6_address_count, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "ipv6AddressCount") unless @ipv6_address_count.nil?
  @ipv6_addresses = ipv6_addresses
  Jsii::Type.check_type(@ipv6_addresses, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNmbkluc3RhbmNlLkluc3RhbmNlSXB2NkFkZHJlc3NQcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "ipv6Addresses") unless @ipv6_addresses.nil?
  @network_interface_id = network_interface_id
  Jsii::Type.check_type(@network_interface_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "networkInterfaceId") unless @network_interface_id.nil?
  @private_ip_address = private_ip_address
  Jsii::Type.check_type(@private_ip_address, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "privateIpAddress") unless @private_ip_address.nil?
  @private_ip_addresses = private_ip_addresses
  Jsii::Type.check_type(@private_ip_addresses, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNmbkluc3RhbmNlLlByaXZhdGVJcEFkZHJlc3NTcGVjaWZpY2F0aW9uUHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "privateIpAddresses") unless @private_ip_addresses.nil?
  @secondary_private_ip_address_count = secondary_private_ip_address_count
  Jsii::Type.check_type(@secondary_private_ip_address_count, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "secondaryPrivateIpAddressCount") unless @secondary_private_ip_address_count.nil?
  @subnet_id = subnet_id
  Jsii::Type.check_type(@subnet_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "subnetId") unless @subnet_id.nil?
end

Instance Attribute Details

#associate_carrier_ip_addressBoolean, ... (readonly)

Indicates whether to assign a carrier IP address to the network interface.

You can only assign a carrier IP address to a network interface that is in a subnet in a Wavelength Zone. For more information about carrier IP addresses, see Carrier IP address in the AWS Wavelength Developer Guide .



2039
2040
2041
# File 'ec2/cfn_instance.rb', line 2039

def associate_carrier_ip_address
  @associate_carrier_ip_address
end

#associate_public_ip_addressBoolean, ... (readonly)

Indicates whether to assign a public IPv4 address to an instance.

Applies only if creating a network interface when launching an instance. The network interface must be the primary network interface. If launching into a default subnet, the default value is true .

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 .



2048
2049
2050
# File 'ec2/cfn_instance.rb', line 2048

def associate_public_ip_address
  @associate_public_ip_address
end

#delete_on_terminationBoolean, ... (readonly)

Indicates whether the network interface is deleted when the instance is terminated.

Applies only if creating a network interface when launching an instance.



2055
2056
2057
# File 'ec2/cfn_instance.rb', line 2055

def delete_on_termination
  @delete_on_termination
end

#descriptionString? (readonly)

The description of the network interface.

Applies only if creating a network interface when launching an instance.



2062
2063
2064
# File 'ec2/cfn_instance.rb', line 2062

def description
  @description
end

#device_indexString (readonly)

The position of the network interface in the attachment order.

A primary network interface has a device index of 0.

If you create a network interface when launching an instance, you must specify the device index.



2032
2033
2034
# File 'ec2/cfn_instance.rb', line 2032

def device_index
  @device_index
end

#ena_srd_specificationAWSCDK::IResolvable, ... (readonly)

Configures ENA Express for UDP network traffic.



2067
2068
2069
# File 'ec2/cfn_instance.rb', line 2067

def ena_srd_specification
  @ena_srd_specification
end

#group_setArray<String>? (readonly)

The IDs of the security groups for the network interface.

Applies only if creating a network interface when launching an instance.



2074
2075
2076
# File 'ec2/cfn_instance.rb', line 2074

def group_set
  @group_set
end

#ipv6_address_countNumeric? (readonly)

A number of IPv6 addresses to assign to the network interface.

Amazon EC2 chooses the IPv6 addresses from the range of the subnet. You cannot specify this option and the option to assign specific IPv6 addresses in the same request. You can specify this option if you've specified a minimum number of instances to launch.



2081
2082
2083
# File 'ec2/cfn_instance.rb', line 2081

def ipv6_address_count
  @ipv6_address_count
end

#ipv6_addressesAWSCDK::IResolvable, ... (readonly)

The IPv6 addresses to assign to the network interface.

You cannot specify this option and the option to assign a number of IPv6 addresses in the same request. You cannot specify this option if you've specified a minimum number of instances to launch.



2088
2089
2090
# File 'ec2/cfn_instance.rb', line 2088

def ipv6_addresses
  @ipv6_addresses
end

#network_interface_idString? (readonly)

The ID of the network interface, when attaching an existing network interface.



2093
2094
2095
# File 'ec2/cfn_instance.rb', line 2093

def network_interface_id
  @network_interface_id
end

#private_ip_addressString? (readonly)

The private IPv4 address of the network interface.

Applies only if creating a network interface when launching an instance.



2100
2101
2102
# File 'ec2/cfn_instance.rb', line 2100

def private_ip_address
  @private_ip_address
end

#private_ip_addressesAWSCDK::IResolvable, ... (readonly)

One or more private IPv4 addresses to assign to the network interface.

Only one private IPv4 address can be designated as primary.



2107
2108
2109
# File 'ec2/cfn_instance.rb', line 2107

def private_ip_addresses
  @private_ip_addresses
end

#secondary_private_ip_address_countNumeric? (readonly)

The number of secondary private IPv4 addresses.

You can't specify this option and specify more than one private IP address using the private IP addresses option.



2114
2115
2116
# File 'ec2/cfn_instance.rb', line 2114

def secondary_private_ip_address_count
  @secondary_private_ip_address_count
end

#subnet_idString? (readonly)

The ID of the subnet associated with the network interface.



2119
2120
2121
# File 'ec2/cfn_instance.rb', line 2119

def subnet_id
  @subnet_id
end

Class Method Details

.jsii_propertiesObject



2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
# File 'ec2/cfn_instance.rb', line 2121

def self.jsii_properties
  {
    :device_index => "deviceIndex",
    :associate_carrier_ip_address => "associateCarrierIpAddress",
    :associate_public_ip_address => "associatePublicIpAddress",
    :delete_on_termination => "deleteOnTermination",
    :description => "description",
    :ena_srd_specification => "enaSrdSpecification",
    :group_set => "groupSet",
    :ipv6_address_count => "ipv6AddressCount",
    :ipv6_addresses => "ipv6Addresses",
    :network_interface_id => "networkInterfaceId",
    :private_ip_address => "privateIpAddress",
    :private_ip_addresses => "privateIpAddresses",
    :secondary_private_ip_address_count => "secondaryPrivateIpAddressCount",
    :subnet_id => "subnetId",
  }
end

Instance Method Details

#to_jsiiObject



2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
# File 'ec2/cfn_instance.rb', line 2140

def to_jsii
  result = {}
  result.merge!({
    "deviceIndex" => @device_index,
    "associateCarrierIpAddress" => @associate_carrier_ip_address,
    "associatePublicIpAddress" => @associate_public_ip_address,
    "deleteOnTermination" => @delete_on_termination,
    "description" => @description,
    "enaSrdSpecification" => @ena_srd_specification,
    "groupSet" => @group_set,
    "ipv6AddressCount" => @ipv6_address_count,
    "ipv6Addresses" => @ipv6_addresses,
    "networkInterfaceId" => @network_interface_id,
    "privateIpAddress" => @private_ip_address,
    "privateIpAddresses" => @private_ip_addresses,
    "secondaryPrivateIpAddressCount" => @secondary_private_ip_address_count,
    "subnetId" => @subnet_id,
  })
  result.compact
end