> For the complete documentation index, see [llms.txt](https://docs.onelens.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.onelens.cloud/automate/remediations/runbooks/runbook-catalog/migrate-ebs-volumes-from-gp2-to-gp3.md).

# Migrate EBS Volumes from gp2 to gp3

## What It Does

Migrates Amazon EBS volumes from `gp2` to `gp3`. The `gp3` volumes offer better price-performance compared to `gp2`, allowing cost savings without compromising performance. This migration is performed safely with snapshot backup and volume modification.

## Risk and Scope

| Detail                   | Value     |
| ------------------------ | --------- |
| **Risk Level**           | Low       |
| **AWS Service Targeted** | EC2 / EBS |

{% hint style="warning" %}

## Permissions Required

**Modify and Create Permissions**

* `ec2:ModifyVolume`
* `ec2:CreateSnapshot`

**Read Permissions**

* `ec2:DescribeVolumes`
* `ec2:DescribeSnapshots`

> These permissions are granted **only to the runbook**, not to the OneLens platform itself.
> {% endhint %}

## Optimization Policies Addressed

This runbook remediates violation tickets triggered by of the following policy:

| Policy ID | Policy Name                                              |
| --------- | -------------------------------------------------------- |
| ebs\_1    | General purpose EBS volumes should be of gp3 volume type |

## Risk Mitigation

{% hint style="success" %}

## Risk Mitigation Strategy

* **Snapshots are** **taken** before the change to prevent any data loss.
* The volume can be **re-created** from that snapshot if needed.
  {% endhint %}

## How to Install

Refer to the [Runbook Setup Guide ](/automate/remediations/runbooks/install-runbooks.md#installing-a-runbook)for steps to install and enable this runbook in your environment.

## Runbook Workflow

### Step 1: Start

**Trigger:** Begins the workflow to migrate EBS volumes from `gp2` to `gp3`.

### Step 2: DescribeVolumes

**Action:** Executes `DescribeVolumes` on EC2 to gather details of all volumes.

### Step 3: setIOPS

**Action:** Runs a script to determine the appropriate IOPS value for the `gp3` volume.

### Step 4: If/Else

**Condition:** Determines whether the volume type is `gp2`.

1. **If the volume is gp2, proceeds with the migration steps:**
   1. **SnapshotVolume**\
      Executes `CreateSnapshot` on EC2 to create a backup of the volume.
   2. **WaitForSnapshotCompletion**\
      Executes `DescribeSnapshots` to ensure the snapshot has completed.
   3. **ModifyVolume**\
      Executes `ModifyVolume` on EC2 to convert the volume type to `gp3` with the specified IOPS.
2. **Else:**\
   Terminates the runbook as the volume is not `gp2`.

## See How it Works

<figure><img src="/files/oWSdN9VXvZjmLlhfoonu" alt=""><figcaption></figcaption></figure>

## Triggering the Runbook

To run this workflow:

### **1. Locate the Ticket**

Identify the ticket associated with the above mentioned policy violation.

### **2. Execute the Runbook**

Follow the steps described in the [executing a runbook](/automate/remediations/runbooks.md#executing-a-runbook) section to apply this runbook to the ticket.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.onelens.cloud/automate/remediations/runbooks/runbook-catalog/migrate-ebs-volumes-from-gp2-to-gp3.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
