In this article:
Change the primary network interface of an instance.
Replace the primary network interface created in a virtual switch with any network interface.
Replace the primary network interface created in a subnet with any network interface from the same VPC.
Replace the primary network interface created in a subnet with any unattached network interface provided that the instance have not any other attached interfaces from other subnets.
The network interface to be used instead of the primary one should be:
in the same availability zone as the source one;
created in a subnet;
not attached to any instance.
You can replace the primary network interface only when the instance is stopped.
InstanceId — The ID of the instance.
NetworkInterfaceId — The ID of the new primary network interface.
attachmentId — The ID of the attachment.
requestId — The ID of the request.
Trueis returned, if the request is successful, and an error otherwise.
c2-ec2 ReplacePrimaryNetworkInterface InstanceId i-12345678 NetworkInterfaceId eni-12345678