Modifies the specified attribute of the specified instance. You can specify only one
attribute at a time.
Note: Using this action to change the security groups
associated with an elastic network interface (ENI) attached to an instance in a VPC can
result in an error if the instance has more than one ENI. To change the security groups
associated with an ENI attached to an instance that has multiple ENIs, we recommend that
you use the ModifyNetworkInterfaceAttribute action.
To modify some attributes, the instance must be stopped. For more information, see
Modify a stopped instance in the
Amazon EC2 User Guide.
example
Use a bare-bones client and the command you need to make an API call.
Modifies the specified attribute of the specified instance. You can specify only one attribute at a time.
Note: Using this action to change the security groups associated with an elastic network interface (ENI) attached to an instance in a VPC can result in an error if the instance has more than one ENI. To change the security groups associated with an ENI attached to an instance that has multiple ENIs, we recommend that you use the ModifyNetworkInterfaceAttribute action.
To modify some attributes, the instance must be stopped. For more information, see Modify a stopped instance in the Amazon EC2 User Guide.
Use a bare-bones client and the command you need to make an API call.
import { EC2Client, ModifyInstanceAttributeCommand } from "@aws-sdk/client-ec2"; // ES Modules import // const { EC2Client, ModifyInstanceAttributeCommand } = require("@aws-sdk/client-ec2"); // CommonJS import const client = new EC2Client(config); const command = new ModifyInstanceAttributeCommand(input); const response = await client.send(command);
ModifyInstanceAttributeCommandInput for command's
input
shape.ModifyInstanceAttributeCommandOutput for command's
response
shape.config for EC2Client's
config
shape.