ResetInstanceAttributeCommand

Resets an attribute of an instance to its default value. To reset the kernel or ramdisk, the instance must be in a stopped state. To reset the sourceDestCheck, the instance can be either running or stopped.

The sourceDestCheck attribute controls whether source/destination checking is enabled. The default value is true, which means checking is enabled. This value must be false for a NAT instance to perform NAT. For more information, see NAT instances  in the Amazon VPC User Guide.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { EC2Client, ResetInstanceAttributeCommand } from "@aws-sdk/client-ec2"; // ES Modules import
// const { EC2Client, ResetInstanceAttributeCommand } = require("@aws-sdk/client-ec2"); // CommonJS import
const client = new EC2Client(config);
const input = { // ResetInstanceAttributeRequest
  DryRun: true || false,
  InstanceId: "STRING_VALUE", // required
  Attribute: "instanceType" || "kernel" || "ramdisk" || "userData" || "disableApiTermination" || "instanceInitiatedShutdownBehavior" || "rootDeviceName" || "blockDeviceMapping" || "productCodes" || "sourceDestCheck" || "groupSet" || "ebsOptimized" || "sriovNetSupport" || "enaSupport" || "enclaveOptions" || "disableApiStop", // required
};
const command = new ResetInstanceAttributeCommand(input);
const response = await client.send(command);
// {};

Example Usage

 Loading code editor

ResetInstanceAttributeCommand Input

Parameter
Type
Description
Attribute
Required
InstanceAttributeName | undefined

The attribute to reset.

You can only reset the following attributes: kernel | ramdisk | sourceDestCheck.

InstanceId
Required
string | undefined

The ID of the instance.

DryRun
boolean | undefined

Checks whether you have the required permissions for the operation, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

ResetInstanceAttributeCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.

Throws

Name
Fault
Details
EC2ServiceException
Base exception class for all service exceptions from EC2 service.