> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coral.inc/llms.txt
> Use this file to discover all available pages before exploring further.

# Terminate on AWS EC2

> How to permanently shut down an EC2 instance running OpenClaw on Amazon Web Services

This guide covers terminating an AWS EC2 instance. Termination permanently deletes the instance. The root EBS volume is deleted by default; other attached volumes may need to be deleted separately.

<Warning>
  Complete the [pre-termination checklist](/security/terminate-instance#pre-termination-checklist) before proceeding. Termination is irreversible.
</Warning>

***

## Option 1: AWS Management Console

<Steps>
  <Step title="Open the EC2 Instances list">
    Sign in to the [AWS Management Console](https://console.aws.amazon.com/ec2/) and navigate to **EC2 → Instances → Instances**.
  </Step>

  <Step title="Select your instance">
    Check the box next to the instance running OpenClaw. Confirm the correct instance by checking its public IP against what appeared on the watchboard.
  </Step>

  <Step title="Disable termination protection if set">
    If termination protection is enabled (Actions → Instance Settings → Change Termination Protection shows "Enabled"), disable it first. Otherwise the terminate action will fail with a `OperationNotPermitted` error.
  </Step>

  <Step title="Terminate the instance">
    Choose **Instance state → Terminate instance** from the Actions menu. Confirm when prompted.

    The instance moves to the **shutting-down** state and then **terminated**. AWS retains the terminated record for about an hour before removing it from the list.
  </Step>
</Steps>

**Official AWS documentation:** [Terminate Amazon EC2 Instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/terminating-instances.html)

***

## Option 2: AWS CLI

If you have the [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) installed and configured:

```bash theme={null}
# Find your instance ID (if you don't have it)
aws ec2 describe-instances \
  --query "Reservations[*].Instances[*].[InstanceId,PublicIpAddress,State.Name]" \
  --output table

# Terminate the instance
aws ec2 terminate-instances --instance-ids i-XXXXXXXXXXXXXXXXX
```

If termination protection is enabled, disable it first:

```bash theme={null}
aws ec2 modify-instance-attribute \
  --instance-id i-XXXXXXXXXXXXXXXXX \
  --no-disable-api-termination
```

**Official AWS CLI reference:** [terminate-instances](https://docs.aws.amazon.com/cli/latest/reference/ec2/terminate-instances.html)

***

## Post-termination cleanup

### Delete unattached EBS volumes

The root EBS volume is deleted automatically when the instance terminates (if "Delete on Termination" was enabled — this is the default). Additional attached volumes are not deleted automatically.

```bash theme={null}
# List unattached volumes
aws ec2 describe-volumes \
  --filters Name=status,Values=available \
  --query "Volumes[*].[VolumeId,Size,CreateTime]" \
  --output table

# Delete a specific volume
aws ec2 delete-volume --volume-id vol-XXXXXXXXXXXXXXXXX
```

### Delete snapshots

```bash theme={null}
# List snapshots owned by your account
aws ec2 describe-snapshots --owner-ids self \
  --query "Snapshots[*].[SnapshotId,Description,StartTime]" \
  --output table

# Delete a snapshot
aws ec2 delete-snapshot --snapshot-id snap-XXXXXXXXXXXXXXXXX
```

### Remove the Security Group

If you created a Security Group specifically for this instance, delete it:

```bash theme={null}
aws ec2 delete-security-group --group-id sg-XXXXXXXXXXXXXXXXX
```

### Release the Elastic IP (if assigned)

Elastic IPs continue to incur charges if not released after the instance is terminated:

```bash theme={null}
# List Elastic IPs
aws ec2 describe-addresses --query "Addresses[*].[PublicIp,AllocationId,AssociationId]"

# Release an unassociated Elastic IP
aws ec2 release-address --allocation-id eipalloc-XXXXXXXXXXXXXXXXX
```

**AWS guide:** [Delete or Terminate EC2 Resources](https://repost.aws/knowledge-center/delete-terminate-ec2)

***

## Rotate credentials

After termination, rotate everything the agent had access to. See the [post-termination checklist](/security/terminate-instance#post-termination-checklist) for the full list.
