When elastic network interfaces (ENIs) are created, deleted, attached, or detached, ENI operation events are triggered and event notifications are sent.

Notifications of ENI operation events

The following conditions must be met to trigger ENI operation events:
  • ENI operation events are in invitational preview.
  • The operation objects are secondary ENIs.

    ENIs are classified into primary ENIs and secondary ENIs. ENI operation events can be triggered only when the operation objects are secondary ENIs. For more information about the attributes of ENIs, see Overview.

  • ENI operations succeed.
    ENI operation events can be triggered only when ENI operations succeed and no error messages are returned. For example, assume that an Elastic Compute Service (ECS) instance has already reached the maximum number of ENIs that the instance can have. If you attempt to attach more ENIs to the instance, the attach operation fails and an error message similar to the one shown in the following figure appears. In this case, no ENI operation event is triggered. max-error
When an ENI operation that meets the preceding conditions is performed, an ENI operation event is triggered and an event notification is sent to the initiator of the operation.
  • If the operation object is a managed ENI, the operation is initiated by an Alibaba Cloud service. When the operation is complete, an event notification is sent to the Alibaba Cloud service. For more information about managed ENIs, see Managed ENIs.
  • If the operation object is a regular ENI, the operation is initiated by a user who attaches, detaches, or deletes the ENI. When the operation is complete, an event notification is sent to the user.

You can make configurations in EventBridge and CloudMonitor to receive notifications of ENI operation events and view the ENI operation results by using emails and DingTalk chatbots. You can obtain the information about the ENIs and configure ENI operations to be automatically performed in response to the notifications. For more information, see Configure event notifications and ECS events.

The following JSON code shows an example notification of an ENI operation event.
{
    "id":"2256A988-0B26-4E2B-820A-8B********A5",
    "product":"ECS",
    "resourceId":"acs:ecs:cn-hangzhou:169070********30:eni/eni-8vb1qo********cdeg2n",
    "level":"INFO",
    "name":"NetworkInterface:NetworkInterfaceOperateCompleted",
    "userId":"169070********30",
    "eventTime":"20190409T121826.922+0800",
    "regionId":"cn-hangzhou",
    "content":{
        "eniId":"eni-8vb1qo********cdeg2n",
        "operation":"AttachNetworkInterface",
        "eniStatus":"InUse",
        "result":"success",
        "requestId":"59701492-A8F2-3375-B0B9-D9********27",
        "primaryPrivateIp": "192.168.XX.XX",
        "secondaryPrivateIps": ["192.168.XX.XX","192.168.XX.XX"],
        "ipv4Prefixes": ["192.168.XX.XX/24"],
        "ipv6s": ["2001:DB8:XXXX:23:8:800:200C:417A"],
        "ipv6Prefixes": ["2001:DB8::/32"]
    }
}
The following table describes the subparameters contained in the content parameter.
SubparameterDescriptionExample
eniIdThe ID of the ENI. eni-8vb1qo********cdeg2n
operationThe type of the operation. Valid values:
  • CreateNetworkInterface: creates an ENI.
  • AttachNetworkInterface: binds an ENI.
  • DetachNetworkInterface: unbinds an ENI.
  • DeleteNetworkInterface: deletes an ENI.
AttachNetworkInterface
eniStatusThe state of the ENI. Valid values:
  • Available: The ENI is available and can be bound to an instance.
  • InUse: The ENI is bound to an instance.
  • Detaching: The ENI is being unbound from an instance.
  • Deleting: The ENI is being deleted.
  • Deleted: The ENI has been deleted.
  • CreateFailed: The ENI cannot be created.
InUse
resultThe operation result. Valid values:
  • success: The operation succeeds and the event level of the ENI operation event is INFO.
  • failed: The operation fails and the event level of the ENI operation event is WARN.
success
requestIdThe ID of the request that corresponds to the operation. 59701492-A8F2-3375-B0B9-D9********27
primaryPrivateIpThe primary private IP address. 192.168.XX.XX
secondaryPrivateIpsThe secondary private IP addresses. ["192.168.XX.XX"]
ipv4PrefixesThe secondary private IP prefixes.["192.168.XX.XX/14"]
ipv6sThe IPv6 addresses. 2001:DB8:XXXX:23:8:800:200C:417A
ipv6PrefixesThe IPv6 prefixes. ["2001:DB8::/32"]