# Change an instance's type

Change a stopped instance to a different instance type so it starts again with more or fewer vCPUs and memory, keeping its identity and volumes.

Change an instance’s type to resize it, or to move it off a type that is no longer offered. Only the size changes. The instance keeps its URN, its addresses and its volumes.

## Before you begin [#before-you-begin]

<BeforeYouBegin>

- An instance that you stopped and that reads `STOPPED`. A `FAILED` instance still holds capacity on its machine, so you can’t change its type. Start and stop it cleanly first, or terminate it.
- Free vCPU quota if the new type is larger. Growing is checked against the same vCPU quota as a launch. Shrinking never is. See [Limits](/docs/platform/reference/limits).

</BeforeYouBegin>

## Change the type [#change-the-type]

1. Stop the instance if it’s running. See [Stop and start an instance](/docs/compute/instances/stop-start).
1. Pick a type whose `available` is `true`:

   ```sh
   origin compute list-instance-types
   ```

1. Change the type:

   ```sh
   origin compute change-instance-type \
     --instance-urn <instance-urn> \
     --instance-type gp1.core.4
   ```

1. Verify the change. `instanceType` on the instance now reads the new type:

   ```sh
   origin compute get-instance --instance-urn <instance-urn>
   ```

1. Start the instance:

   ```sh
   origin compute start-instance --instance-urn <instance-urn>
   ```

## Using the API [#using-the-api]

```graphql
mutation {
  compute {
    changeInstanceType(input: {
      instanceUrn: "<instance-urn>"
      instanceType: "gp1.core.4"
    }) {
      accepted
      message
    }
  }
}
```

## If this fails [#if-this-fails]

- [`PRODUCT_UNAVAILABLE`](/docs/platform/reference/errors#product_unavailable): the type you named is no longer offered. Pick one whose `available` is `true`. See [Instance types](/docs/compute/instances/instance-types).
- Quota exceeded: the larger type would take the organization or project past its vCPU limit. Choose a smaller type or request a higher limit.
- The instance isn’t stopped: stop it first and wait for `STOPPED`.

## Related [#related]

- [`change-instance-type` reference](/docs/compute/reference/cli#change-instance-type)
- [Instance types](/docs/compute/instances/instance-types)

