> [!CAUTION]
> You are currently viewing version 1.1 of the Apigee hybrid documentation. **This version is end of life.** You should upgrade to a newer version. For more information, see [Supported versions](https://docs.cloud.google.com/apigee/docs/hybrid/supported-platforms.md.txt#supported-versions).

<button class="button button-with-icon cloud-select-dropdown__button button-primary" aria-haspopup="true">Version 1.1 (unsupported)</button>

- Supported versions:
- [v1.17 (latest)](https://docs.cloud.google.com/apigee/docs/hybrid/v1.17/environment-delete.md.txt)
- [v1.16](https://docs.cloud.google.com/apigee/docs/hybrid/v1.16/environment-delete.md.txt)
- [v1.15](https://docs.cloud.google.com/apigee/docs/hybrid/v1.15/environment-delete.md.txt)
- [v1.14](https://docs.cloud.google.com/apigee/docs/hybrid/v1.14/environment-delete.md.txt)
- [List of supported versions](https://docs.cloud.google.com/apigee/docs/hybrid/supported-platforms.md.txt#supported-versions)
- Unsupported versions:
- [v1.13](https://docs.cloud.google.com/apigee/docs/hybrid/v1.13/environment-delete.md.txt)
- [v1.12](https://docs.cloud.google.com/apigee/docs/hybrid/v1.12/environment-delete.md.txt)
- [v1.11](https://docs.cloud.google.com/apigee/docs/hybrid/v1.11/environment-delete.md.txt)
- [v1.10](https://docs.cloud.google.com/apigee/docs/hybrid/v1.10/environment-delete.md.txt)
- [v1.9](https://docs.cloud.google.com/apigee/docs/hybrid/v1.9/environment-delete.md.txt)
- [v1.8](https://docs.cloud.google.com/apigee/docs/hybrid/v1.8/environment-delete.md.txt)
- [v1.7](https://docs.cloud.google.com/apigee/docs/hybrid/v1.7/environment-delete.md.txt)
- [v1.6](https://docs.cloud.google.com/apigee/docs/hybrid/v1.6/environment-delete.md.txt)
- [v1.5](https://docs.cloud.google.com/apigee/docs/hybrid/v1.5/environment-delete.md.txt)
- [v1.4](https://docs.cloud.google.com/apigee/docs/hybrid/v1.4/environment-delete.md.txt)
- [v1.3](https://docs.cloud.google.com/apigee/docs/hybrid/v1.3/environment-delete.md.txt)
- [v1.2](https://docs.cloud.google.com/apigee/docs/hybrid/v1.2/environment-delete.md.txt)
- [v1.1](https://docs.cloud.google.com/apigee/docs/hybrid/v1.1/environment-delete.md.txt)


This topic explains how to delete environments. For an introduction, see
[About environments and environment groups](https://docs.cloud.google.com/apigee/docs/api-platform/fundamentals/environments-overview.md.txt).

## About deleting environments


To delete an environment properly, you must make several configuration changes and
apply them to your cluster. These changes include removing the environment definition from
your overrides file, deleting the `synchronizer`, `runtime`,
and `udca` components, and finally re-applying your overrides to
restore your cluster without
including the environment you wish to delete.


The reason you can't only delete the environment in one step is because the other elements,
`synchronizer`, `runtime`,
and `udca` are connected to each environment through their internal configurations. Only by
deleting them and re-applying them can you properly delete an environment.

## How to delete an environment

Assume that you have two environments, **test** and **prod**. In
your overrides file, the definitions might look something like this:

```
...
envs:
  - name: test
    sslCertPath: "your_certpath/ingress-cert.crt"
    sslKeyPath: "your_keypath/ingress-key.key"
    hostAlias: "apitest.example.com"
    serviceAccountPaths:
      synchronizer: "your_keypath/synchronizer-manager-service-account.json
      udca: "your_keypath/analytic-agent-service-account.json
  - name: prod
    sslCertPath: "your_certpath/ingress-cert.crt"
    sslKeyPath: "your_keypath/ingress-key.key"
    hostAlias: "apiprod.example.com"
    serviceAccountPaths:
      synchronizer: "your_keypath/synchronizer-manager-service-account.json
      udca: "your_keypath/analytic-agent-service-account.json
...
```

To delete the **prod** environment, follow these steps:

1. Copy your original overrides file -- the one that contains both the **prod** and **test** environment definitions -- to a new file called, for example, `prod-delete.yaml`.
2. Open `prod-delete.yaml`.
3. Delete the `test` environment definition from `envs`, leaving only the **prod** definition. For example:

   ```
   ...
   envs:
     - name: prod
       sslCertPath: "your_certpath/ingress-cert.crt"
       sslKeyPath: "your_keypath/ingress-key.key"
       hostAlias: "apitest.example.com"
       serviceAccountPaths:
         synchronizer: "your_keypath/synchronizer-manager-service-account.json
         udca: "your_keypath/analytic-agent-service-account.json
   ```
4. Remove everything else from `prod-delete.yaml` ***except*** the `cassandra` config, if present:


   After making the above changes, your overrides file should look something
   like this:

   ```
   ...
   envs:
     - name: prod
       sslCertPath: "your_certpath/ingress-cert.crt"
       sslKeyPath: "your_keypath/ingress-key.key"
       hostAlias: "apitest.example.com"
       serviceAccountPaths:
         synchronizer: "your_keypath/synchronizer-manager-service-account.json
         udca: "your_keypath/analytic-agent-service-account.json
   cassandra:
     replicaCount: 3
     resources:
       requests:
         cpu: 3500m
         memory: 7Gi
     storage:
       storageClass: pd-ssd
       capacity: 10Gi

     
   ```
5. Run this command to delete the specified components:

   ```
   apigeectl delete -f prod-delete.yaml -c runtime, udca, synchronizer
   ```
6. Open your **original** overrides file (the one that includes both the test and prod environment definitions).
7. Delete the `prod` environment definition from the `envs` element. You only want the `test` environment definition to be present in the file.
8. Apply the modified overrides file to your cluster. This command will recreate the deleted elements and, because it is omitted, not recreate the `prod` environment.

   ```
   apigeectl apply -f prod-delete.yaml -c runtime, udca, synchronizer
   ```
9. Save your changes.

10. You're not quite done. You must now update the environments in the hybrid UI.
11. Open a browser and navigate to the hybrid UI at [Apigee UI](https://apigee.google.com).
12. Remove the environment using the steps described [Delete an existing environment in the Hybrid UI](https://docs.cloud.google.com/apigee/docs/hybrid/v1.1/manage-environments.md.txt#delete).