> This page is for API.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.eon.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.eon.io/_mcp/server.

# Restore EC2 Instance

POST https://%7Baccount-domain%7D.console.eon.io/api/v1/projects/{projectId}/resources/{id}/snapshots/{snapshotId}/restore-ec2-instance
Content-Type: application/json

Restores an EC2 instance from an Eon snapshot.

When restoring an EC2 instance, you'll need to specify the configurations of the instance and each volume you want to restore.
You can retrieve the configurations from the snapshot by calling [Get Snapshot](/api/api-reference/backup-management/snapshots/get-snapshot) or [List Resource Snapshots](/api/api-reference/backup-management/snapshots/list-resource-snapshots).

This operation is asynchronous.
It triggers a restore job and returns a job ID, which can be used to track the progress of the restore job.
You can follow the progress of the restore job by calling [Get Restore Job](/api/api-reference/jobs/restore-jobs/get-restore-job) with the job ID.


Reference: https://docs.eon.io/api/api-reference/restore/restore-aws/restore-ec-2-instance

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `projectId` (string, required) — ID of the project the snapshot is in. You can get your project ID from the [API Credentials](https://console.eon.io/global-management/api-credentials) page in your global management console.
- `id` (string, required) — Eon-assigned resource ID.
- `snapshotId` (string, required) — ID of the Eon [snapshot](/api/api-reference/backup-management/snapshots/list-resource-snapshots) to restore.

### Headers

- `X-Action-Approval-Request-Id` (string, optional) — ID of an approved action request. Applicable only when the method is protected by an action approval policy and the action request has been approved.&nbsp; When used, the current API request must match the original request parameters. The approved action request can be executed only by the original requester.

### Body (application/json)

This endpoint expects a RestoreAwsEc2InstanceRequest.

- `restoreAccountId` (string, required) — Eon-assigned ID of the restore account.
- `destination` (AwsEc2InstanceRestoreDestination, required) — Restore configuration.

## Response

### 201

Applicable only when the method is protected by an [action approval policy]. An action request was created in an initial state. The action request needs to be submitted for approval by passing its ID to [Submit Action Approval Request](https://docs.eon.io/api/api-reference/access-management/action-approvals/my-action-requests/create-action-approval-request). [action approval policy]: /api/using-the-api/action-approvals

- `actionApprovalRequest` (MPARequest, required) — Action request details.

### 202

Restore job started.

- `jobId` (string, required) — Restore job ID.

## Errors

### 404 Not Found Error

Project, resource, or snapshot wasn't found.

- `any`

## Types

### AwsEc2InstanceRestoreDestination

- `awsEc2` (AwsEc2InstanceRestoreTarget, optional) — Configuration for restoring to an EC2 instance.

### MPARequest

Action request details.

- `id` (string, required) — ID of the action request.
- `operation` (enum, required) — Operation that requires action approval before it can be completed.
  - Allowed values: `MPA_OPERATION_TYPE_UNSPECIFIED`, `MPA_OPERATION_ADD_RESTORE_ACCOUNT`, `MPA_OPERATION_RESTORE_RESOURCE`, `MPA_OPERATION_UPDATE_BACKUP_POLICY`, `MPA_OPERATION_DELETE_BACKUP_POLICY`, `MPA_OPERATION_CREATE_BACKUP_POLICY`
- `requesterEmail` (string, required) — Email address of the requester.
- `status` (enum, required) — Action request status. For an explanation of statuses, see [Action Request Statuses](/data-protection/account-administration/access-management/action-approvals/action-request-statuses).
  - Allowed values: `MPA_REQUEST_STATUS_UNSPECIFIED`, `CREATED`, `PENDING_APPROVAL`, `APPROVED`, `DENIED`, `EXPIRED_PENDING_APPROVAL`, `EXPIRED_APPROVED`, `EXECUTED`, `CANCELED_PENDING_APPROVAL`, `CANCELED_APPROVED`, `DISCARDED`
- `policyDetails` (list of MPARequestPolicyDetail, required) — List of the action request's approval rules. Each item contains the rule's configuration and approval progress.
- `createdTime` (datetime, required) — Time when the approval request was created.
- `requesterName` (string, optional) — Display name of the requester at the time the request was created.
- `comment` (string, optional) — Comment from the requester explaining why they want to perform the action.
- `approvalExpirationTime` (datetime, optional, nullable) — Deadline for gathering approvals. Omitted before the request is submitted or after it's discarded.
- `executionExpirationTime` (datetime, optional, nullable) — Deadline for completing the approved action. Set when the request is approved.
- `resolvedTime` (datetime, optional, nullable) — Time when the request reached a terminal state, such as executed, expired, canceled, denied, or discarded. Omitted while the request is still active.

### AwsEc2InstanceRestoreTarget

- `region` (string, required) — Region to restore the instance to.
- `instanceType` (string, required) — Instance type to use for the restored instance.
- `subnetId` (string, required) — Subnet ID to associate with the restored instance.
- `volumeRestoreParameters` (list of RestoreInstanceVolumeInput, required) — Volumes to restore and attach to the restored instance. Each item in the list corresponds to a volume to be restored, where `providerVolumeId` matches the volume's ID at the time of the snapshot. The root volume must be present in the list.
- `securityGroupIds` (list of string, optional) — List of security group IDs to associate with the restored instance.
- `privateIpAddress` (string, optional) — Primary private IPv4 address for the restored instance. Must fall within the selected subnet's CIDR range. Omit to let AWS auto-assign an address.
- `tags` (map from string to string, optional) — Tags to apply to the restored instance as key-value pairs, where key and value are both strings. **Example:** `{"eon_api_restore": "true"}`
- `startInstanceAfterRestore` (boolean, optional, default: true) — Whether to start the EC2 instance after restoring it. If set to `false`, the instance remains in a stopped state.

### MPARequestPolicyDetail

- `requiredApprovals` (integer, required) — Count of approvals the rule requires.
- `currentApprovals` (integer, required) — Count of qualifying approvals received.
- `executionWindowHours` (integer, required) — After all required approvals are received, number of hours the requester has to complete the action.
- `approvalWindowHours` (integer, required) — After submitting the action request, number of hours allowed for gathering all required approvals.
- `description` (string, optional) — Rule description.
- `approverIdpId` (string, optional, nullable) — Eon-assigned ID of the SAML identity provider the approver group belongs to. Used in combination with `approverProviderGroupId`.
- `approverProviderGroupId` (string, optional, nullable) — Identity-provider-assigned ID of the group. Used in combination with `approverIdpId`.

### RestoreInstanceVolumeInput

- `providerVolumeId` (string, required) — Cloud-provider-assigned ID of the volume to restore.
- `volumeEncryptionKeyId` (string, required) — ARN of the KMS key for encrypting the restored volume.
- `volumeSettings` (VolumeSettings, required) — Settings to use for the restored volume.
- `description` (string, optional) — Optional description.
- `tags` (map from string to string, optional) — Tags to apply to the restored volume as key-value pairs, where key and value are both strings. **Example:** `{"primary": ""}`

### VolumeSettings

Provisioned volume settings.

- `type` (string, required) — Volume type.
- `sizeBytes` (long, required) — Volume size in bytes.
- `iops` (integer, optional) — Volume IOPS.
- `throughput` (integer, optional) — Volume throughput.

## Examples

### Example 1

**Request**

```json
{
  "restoreAccountId": "1ee34dc5-0a7c-4e56-a820-917371e05c8d"
}
```

**Response**

```json
{
  "actionApprovalRequest": {
    "id": "018f3b3f-4818-7c31-a0d7-2e02f2f83a10",
    "operation": "MPA_OPERATION_DELETE_BACKUP_POLICY",
    "requesterEmail": "requester@example.com",
    "status": "PENDING_APPROVAL",
    "policyDetails": [
      {
        "requiredApprovals": 2,
        "currentApprovals": 1,
        "executionWindowHours": 4,
        "approvalWindowHours": 24,
        "description": "Require approval before deleting backup policies.",
        "approverIdpId": "018f3b3f-4818-7c31-a0d7-2e02f2f83a31",
        "approverProviderGroupId": "platform-admins"
      }
    ],
    "createdTime": "2026-05-04T23:00:05Z",
    "requesterName": "Riley Chen",
    "comment": "Removing a backup policy that has been replaced.",
    "approvalExpirationTime": "2026-05-05T03:00:05Z",
    "executionExpirationTime": "2026-05-05T07:00:05Z",
    "resolvedTime": "2026-05-05T02:10:12Z"
  }
}
```

**SDK Code**

```python
import requests

url = "https://{account-domain}.console.eon.io/api/v1/projects/1ee34dc5-0a7c-4e56-a820-917371e05c8d/resources/fb806ce1-1cd3-5034-928a-33a87be714da/snapshots/3dc6c0c6-f94d-5e85-a174-4b981a4bb262/restore-ec2-instance"

payload = { "restoreAccountId": "1ee34dc5-0a7c-4e56-a820-917371e05c8d" }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://{account-domain}.console.eon.io/api/v1/projects/1ee34dc5-0a7c-4e56-a820-917371e05c8d/resources/fb806ce1-1cd3-5034-928a-33a87be714da/snapshots/3dc6c0c6-f94d-5e85-a174-4b981a4bb262/restore-ec2-instance';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"restoreAccountId":"1ee34dc5-0a7c-4e56-a820-917371e05c8d"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://{account-domain}.console.eon.io/api/v1/projects/1ee34dc5-0a7c-4e56-a820-917371e05c8d/resources/fb806ce1-1cd3-5034-928a-33a87be714da/snapshots/3dc6c0c6-f94d-5e85-a174-4b981a4bb262/restore-ec2-instance")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"restoreAccountId\": \"1ee34dc5-0a7c-4e56-a820-917371e05c8d\"\n}")
  .asString();
```

### Example 2

**Request**

```json
{
  "restoreAccountId": "1ee34dc5-0a7c-4e56-a820-917371e05c8d"
}
```

**Response**

```json
{
  "jobId": "9892ecab-22d5-47ca-b2b4-70369e80b90a"
}
```

**SDK Code**

```python
import requests

url = "https://{account-domain}.console.eon.io/api/v1/projects/1ee34dc5-0a7c-4e56-a820-917371e05c8d/resources/fb806ce1-1cd3-5034-928a-33a87be714da/snapshots/3dc6c0c6-f94d-5e85-a174-4b981a4bb262/restore-ec2-instance"

payload = { "restoreAccountId": "1ee34dc5-0a7c-4e56-a820-917371e05c8d" }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://{account-domain}.console.eon.io/api/v1/projects/1ee34dc5-0a7c-4e56-a820-917371e05c8d/resources/fb806ce1-1cd3-5034-928a-33a87be714da/snapshots/3dc6c0c6-f94d-5e85-a174-4b981a4bb262/restore-ec2-instance';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"restoreAccountId":"1ee34dc5-0a7c-4e56-a820-917371e05c8d"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://{account-domain}.console.eon.io/api/v1/projects/1ee34dc5-0a7c-4e56-a820-917371e05c8d/resources/fb806ce1-1cd3-5034-928a-33a87be714da/snapshots/3dc6c0c6-f94d-5e85-a174-4b981a4bb262/restore-ec2-instance")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"restoreAccountId\": \"1ee34dc5-0a7c-4e56-a820-917371e05c8d\"\n}")
  .asString();
```