Skip to content

/AWS1/CL_EC2=>ATTACHNETWORKINTERFACE()

About AttachNetworkInterface

Attaches a network interface to an instance.

Method Signature

IMPORTING

Required arguments:

iv_networkinterfaceid TYPE /AWS1/EC2NETWORKINTERFACEID /AWS1/EC2NETWORKINTERFACEID

The ID of the network interface.

iv_instanceid TYPE /AWS1/EC2INSTANCEID /AWS1/EC2INSTANCEID

The ID of the instance.

iv_deviceindex TYPE /AWS1/EC2INTEGER /AWS1/EC2INTEGER

The index of the device for the network interface attachment.

Optional arguments:

iv_networkcardindex TYPE /AWS1/EC2INTEGER /AWS1/EC2INTEGER

The index of the network card. Some instance types support multiple network cards. The primary network interface must be assigned to network card index 0. The default is network card index 0.

io_enasrdspecification TYPE REF TO /AWS1/CL_EC2ENASRDSPEC /AWS1/CL_EC2ENASRDSPEC

Configures ENA Express for the network interface that this action attaches to the instance.

iv_enaqueuecount TYPE /AWS1/EC2INTEGER /AWS1/EC2INTEGER

The number of ENA queues to be created with the instance.

iv_dryrun TYPE /AWS1/EC2BOOLEAN /AWS1/EC2BOOLEAN

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

RETURNING

oo_output TYPE REF TO /aws1/cl_ec2attachnetworkint01 /AWS1/CL_EC2ATTACHNETWORKINT01

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->/aws1/if_ec2~attachnetworkinterface(
  io_enasrdspecification = new /aws1/cl_ec2enasrdspec(
    io_enasrdudpspecification = new /aws1/cl_ec2enasrdudpspec( ABAP_TRUE )
    iv_enasrdenabled = ABAP_TRUE
  )
  iv_deviceindex = 123
  iv_dryrun = ABAP_TRUE
  iv_enaqueuecount = 123
  iv_instanceid = |string|
  iv_networkcardindex = 123
  iv_networkinterfaceid = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_string = lo_result->get_attachmentid( ).
  lv_integer = lo_result->get_networkcardindex( ).
ENDIF.

To attach a network interface to an instance

This example attaches the specified network interface to the specified instance.

DATA(lo_result) = lo_client->/aws1/if_ec2~attachnetworkinterface(
  iv_deviceindex = 1
  iv_instanceid = |i-1234567890abcdef0|
  iv_networkinterfaceid = |eni-e5aa89a3|
).