You can subscribe to notifications for vSwitch change events that are triggered when you modify the configurations of the virtual private clouds (VPCs) or vSwitches of Elastic Compute Service (ECS) instances. The events provide details of the instances, such as instance IDs, vSwitch IDs, and private IP addresses.
Notifications for vSwitch change events
vSwitch change events are generated in the following scenarios:
When you call the ModifyInstanceVpcAttribute operation to modify the VPC attribute of an ECS instance, a vSwitch change event is triggered.
The following sample code provides an example of a notification in JSON format for a vSwitch change event:
{
"id":"2256A988-0B26-4E2B-820A-8B********A5",
"product":"ECS",
"resourceId":"acs:ecs:cn-hangzhou:169070********30:eni/eni-8vb1qo********cdeg2n",
"level":"INFO",
"name":"Instance:VSwitchChanged",
"userId":"169070********30",
"eventTime":"20230409T121826.922+0800",
"regionId":"cn-hangzhou",
"content":{
"instanceId":"i-8vb1qo********cdeg2n",
"vswitchId":"vsw-bp1s5fnvk4gn3tw12****",
"privateIpAddress":"172.17.XX.XX",
"vpcId":"vpc-bp1vwnn14rqpyiczj****",
"secondaryPrivateIps":["172.17.XX.XX"]
}
}The following table describes the fields that are contained in the content parameter.
Field | Description | Example |
instanceId | The ID of the ECS instance. | i-bp1ecr********5go2go |
vswitchId | The ID of the vSwitch to which the ECS instance is connected. | vsw-bp1s5fnvk4gn3tw12**** |
privateIpAddress | The primary private IP address of the ECS instance. | 172.17.XX.XX |
vpcId | The ID of the VPC in which the ECS instance resides. | vpc-bp1vwnn14rqpyiczj**** |
secondaryPrivateIps | The secondary private IP addresses of the primary network interface on the ECS instance. | ["172.17.XX.XX"] |