When elastic network interfaces (ENIs) are created, deleted, bound to Elastic Compute Service (ECS) instances, or unbound from ECS instances, ENI operation events are triggered. You can use Alibaba Cloud CloudMonitor and Simple Message Queue (formerly MNS) to manage ENIs in response to notifications of ENI operation events. You can poll operations to query ENI status and check whether ENI operation events are properly handled.
Scenarios
You can use two methods that are suitable for different scenarios to obtain the results of ENI operation events. The following table provides a comparison between the two methods.
Method | Latency | Resource occupation | Disadvantage |
Use an event-driven architecture | Low | High | You are charged for using MNS. |
Poll for ENI status | High | Low | The operation that you poll may be throttled. |
Examples
The following topics describe the best practices for managing ENIs by using ECS SDK for Java: