

There are more AWS SDK examples available in the [AWS Doc SDK Examples](https://github.com/awsdocs/aws-doc-sdk-examples) GitHub repo.

# Use `ResetInstanceAttribute` with a CLI

The following code examples show how to use `ResetInstanceAttribute`.

------
#### [ CLI ]

**AWS CLI**  
**Example 1: To reset the sourceDestCheck attribute**  
The following `reset-instance-attribute` example resets the `sourceDestCheck` attribute of the specified instance. The instance must be in a VPC.  

```
aws ec2 reset-instance-attribute \
    --instance-id {{i-1234567890abcdef0}} \
    --attribute {{sourceDestCheck}}
```
This command produces no output.  
For more information, see [NAT instances](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_NAT_Instance.html) in the *Amazon VPC User Guide*.  
**Example 2: To reset the kernel attribute**  
The following `reset-instance-attribute` example resets the `kernel` attribute of the specified instance. The instance must be in the `stopped` state.  

```
aws ec2 reset-instance-attribute \
    --instance-id {{i-1234567890abcdef0}} \
    --attribute {{kernel}}
```
This command produces no output.  
For more information, see [User provided kernels](https://docs.aws.amazon.com/linux/al2/ug/UserProvidedKernels.html) in the *Amazon Linux 2 User Guide*.  
**Example 3: To reset the ramdisk attribute**  
The following `reset-instance-attribute` example resets the `ramdisk` attribute of the specified instance. The instance must be in the `stopped` state.  

```
aws ec2 reset-instance-attribute \
    --instance-id {{i-1234567890abcdef0}} \
    --attribute {{ramdisk}}
```
This command produces no output.  
For more information, see [User provided kernels](https://docs.aws.amazon.com/linux/al2/ug/UserProvidedKernels.html) in the *Amazon Linux 2 User Guide*.  
+  For API details, see [ResetInstanceAttribute](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/reset-instance-attribute.html) in *AWS CLI Command Reference*. 

------
#### [ PowerShell ]

**Tools for PowerShell V4**  
**Example 1: This example resets the 'sriovNetSupport' attribute for the specified instance.**  

```
Reset-EC2InstanceAttribute -InstanceId i-12345678 -Attribute sriovNetSupport
```
**Example 2: This example resets the 'ebsOptimized' attribute for the specified instance.**  

```
Reset-EC2InstanceAttribute -InstanceId i-12345678 -Attribute ebsOptimized
```
**Example 3: This example resets the 'sourceDestCheck' attribute for the specified instance.**  

```
Reset-EC2InstanceAttribute -InstanceId i-12345678 -Attribute sourceDestCheck
```
**Example 4: This example resets the 'disableApiTermination' attribute for the specified instance.**  

```
Reset-EC2InstanceAttribute -InstanceId i-12345678 -Attribute disableApiTermination
```
**Example 5: This example resets the 'instanceInitiatedShutdownBehavior' attribute for the specified instance.**  

```
Reset-EC2InstanceAttribute -InstanceId i-12345678 -Attribute instanceInitiatedShutdownBehavior
```
+  For API details, see [ResetInstanceAttribute](https://docs.aws.amazon.com/powershell/v4/reference) in *AWS Tools for PowerShell Cmdlet Reference (V4)*. 

**Tools for PowerShell V5**  
**Example 1: This example resets the 'sriovNetSupport' attribute for the specified instance.**  

```
Reset-EC2InstanceAttribute -InstanceId i-12345678 -Attribute sriovNetSupport
```
**Example 2: This example resets the 'ebsOptimized' attribute for the specified instance.**  

```
Reset-EC2InstanceAttribute -InstanceId i-12345678 -Attribute ebsOptimized
```
**Example 3: This example resets the 'sourceDestCheck' attribute for the specified instance.**  

```
Reset-EC2InstanceAttribute -InstanceId i-12345678 -Attribute sourceDestCheck
```
**Example 4: This example resets the 'disableApiTermination' attribute for the specified instance.**  

```
Reset-EC2InstanceAttribute -InstanceId i-12345678 -Attribute disableApiTermination
```
**Example 5: This example resets the 'instanceInitiatedShutdownBehavior' attribute for the specified instance.**  

```
Reset-EC2InstanceAttribute -InstanceId i-12345678 -Attribute instanceInitiatedShutdownBehavior
```
+  For API details, see [ResetInstanceAttribute](https://docs.aws.amazon.com/powershell/v5/reference) in *AWS Tools for PowerShell Cmdlet Reference (V5)*. 

------