The commands in `anthos-gke aws management` deploy and delete
GKE on AWS
[management services](https://docs.cloud.google.com/kubernetes-engine/multi-cloud/docs/aws/previous-generation/concepts/architecture.md.txt). You use the
[`init`](https://docs.cloud.google.com/kubernetes-engine/multi-cloud/docs/aws/previous-generation/reference/anthos-gke-management.md.txt#init) and [`apply`](https://docs.cloud.google.com/kubernetes-engine/multi-cloud/docs/aws/previous-generation/reference/anthos-gke-management.md.txt#apply) commands to provision a management
service.
You use the [`get-credentials`](https://docs.cloud.google.com/kubernetes-engine/multi-cloud/docs/aws/previous-generation/reference/anthos-gke-management.md.txt#get-credentials) command to authenticate to your management service, and you use the [`delete`](https://docs.cloud.google.com/kubernetes-engine/multi-cloud/docs/aws/previous-generation/reference/anthos-gke-management.md.txt#delete)
command to uninstall your GKE on AWS environment. You can use the [`diagnose`](https://docs.cloud.google.com/kubernetes-engine/multi-cloud/docs/aws/previous-generation/reference/anthos-gke-management.md.txt#diagnose) command to gather additional information for debugging.

## Init

The `anthos-aws init` command does the following:

- Prepares a working directory that contains an `anthos-gke.yaml` file.
- Validates the configuration. During validation, `init` checks that the `anthos-gke.yaml` file contains all [required fields](https://docs.cloud.google.com/kubernetes-engine/multi-cloud/docs/aws/previous-generation/reference/awsmanagementservice.md.txt), the user has sufficient permissions, and referenced resources such as AWS KMS keys exist.
- Creates or appends status information to `anthos-gke-status.yaml`.This file includes a generated cluster ID, an SSH public key, encrypted Google Cloud service account keys, and an encrypted Kubernetes CA certificate.

You run `anthos-gke init` before [`anthos-gke apply`](https://docs.cloud.google.com/kubernetes-engine/multi-cloud/docs/aws/previous-generation/reference/anthos-gke-management.md.txt#apply).

    anthos-gke aws management init DIRECTORY

### Positional arguments


`DIRECTORY`
:   An optional argument for the directory containing the
    `anthos-gke.yaml` file. Defaults to the current directory.

<br />

### Examples

To initialize the current working directory, run the following command:

```bash
anthos-gke aws management init
```

To initialize a specific directory, run the following command:

```bash
anthos-gke aws management init DIRECTORY
```

Replace <var translate="no">DIRECTORY</var> with the directory containing your
`anthos-gke.yaml` file.

## Apply

> [!IMPORTANT]
> **Important:** When you create or update your `anthos-gke.yaml` file, be sure to run [`anthos-gke aws management init`](https://docs.cloud.google.com/kubernetes-engine/multi-cloud/docs/aws/previous-generation/reference/anthos-gke-management.md.txt#init) before `apply`.

The `apply` command provisions a
[management service](https://docs.cloud.google.com/kubernetes-engine/multi-cloud/docs/aws/previous-generation/concepts/architecture.md.txt) on AWS. The command
also creates a
[Cloud Storage](https://cloud.google.com/storage) bucket that
GKE on AWS uses for Terraform
[state](https://www.terraform.io/docs/state/index.html).

    anthos-gke aws management apply DIRECTORY

### Positional arguments


`DIRECTORY`
:   An optional argument for the directory containing the
    `anthos-gke.yaml` file. Defaults to the current directory.

<br />

### Examples

To create a management service from configuration in the current working
directory, run the following command:

```bash
$ anthos-gke aws management apply
```

To create a management service from configuration in a specific directory
(`~/example/workspace`, for example), run the following command:

```bash
$ anthos-gke aws management apply DIRECTORY
```

Replace <var translate="no">DIRECTORY</var> with the directory containing your
`anthos-gke.yaml`.

## Get-credentials

The `get-credentials` command updates your `kubeconfig` file with credentials
and endpoint information for a your management service. By default, credentials
are appended to `~/.kube/config`. You can set a different path to your
kubeconfig by setting the `KUBECONFIG` environment variable.

    anthos-gke aws management get-credentials [--workspace DIRECTORY]

### Flags

`--workspace DIRECTORY`
:   An optional argument for the directory containing the
    `anthos-gke.yaml` file. Defaults to the current directory.

### Examples

To get credentials for a management service defined in the current working
directory, run the following command:

```bash
anthos-gke aws management get-credentials
```

To get credentials for a management service defined in a specific directory, run the following command:

```bash
anthos-gke aws management get-credentials --workspace DIRECTORY
```

Replace <var translate="no">DIRECTORY</var> with the directory containing your
`anthos-gke.yaml`.

## Diagnose

The `diagnose snapshot` command generates a support bundle to help Google
support debug issues with your management service. The support bundle is a tar
file which includes configuration, cluster events, and logs. For more
information, see [Troubleshooting](https://docs.cloud.google.com/kubernetes-engine/multi-cloud/docs/aws/previous-generation/troubleshooting.md.txt#snapshots)

    anthos-gke aws management diagnose snapshot
               --ssh-key-path PATH \
               [--bastion-ip IP] \
               [--bastion-ssh-key-path PATH] \
               [--cluster-ssh-key-path PATH] \
               [--dry-run] \
               [--mgmt-service-ssh-key-path PATH] \
               [--nodepool-ssh-key-path PATH] \
               [--output PATH] \
               [--snapshot-config PATH] \
               [--workspace DIRECTORY] \
               [--quiet]

### Flags

`--ssh-key-path PATH`
:   A required argument which gives the path to an SSH key file. For most users,
    this value should be `~/.ssh/anthos-gke`.

### Optional flags

`[--bastion-ip IP]`
:   Specifies a [bastion host](https://docs.cloud.google.com/kubernetes-engine/multi-cloud/docs/aws/previous-generation/how-to/installing-management.md.txt#connect)
    IP address.

`[--bastion-ssh-key-path PATH]`
:   The path to an SSH key file for the bastion host. Defaults to
    `--ssh-key-path`.

`[--cluster-ssh-key-path PATH]`
:   The path to an SSH key file for the workload cluster control plane machines.
    Defaults to `--ssh-key-path`.

`[--dry-run]`
:   An option to display the snapshot configuration file without generating a
    support bundle.

`[--mgmt-service-ssh-key-path PATH]`
:   The path to an SSH key file for the management service. Defaults to
    `--ssh-key-path`.

`[--nodepool-ssh-key-path PATH]`
:   The path to an SSH key file for node pool machines. Defaults to
    `--ssh-key-path`.

`[--snapshot-config PATH]`
:   The path to a YAML snapshot configuration file (optional).

`[--output PATH]`
:   The path where `anthos-gke` creates the support bundle file.

`--workspace DIRECTORY`
:   An optional argument for the directory containing the
    `anthos-gke.yaml` file. Defaults to the current directory.

`[--quiet]`
:   Eliminate messages printed to the console.

### Examples

To generate a support bundle for a management service defined in the
`~/example/workspace` directory, run the following command:

```bash
anthos-gke aws management diagnose snapshot \
             --ssh-key-path ~/.ssh/anthos-gke \
             --workspace ~/example/workspace
```

To view the default snapshot configuration, run the following command:

```bash
anthos-gke aws management diagnose snapshot \
             --ssh-key-path ~/.ssh/anthos-gke \
             --dry-run
```

To specify a custom snapshot configuration file (including your own bash and
kubectl commands), run the following command:

```bash
anthos-gke aws management diagnose snapshot \
             --ssh-key-path ~/.ssh/anthos-gke
             --snapshot-config ~/my-snapshot-config.yaml
```

## Delete

The `anthos-gke aws management delete` command deletes a management cluster.

> [!WARNING]
> **Warning:** To run this command, you must delete all user clusters and external load balancers or persistent disk volumes associated with your user clusters. [Remove these resources](https://docs.cloud.google.com/kubernetes-engine/multi-cloud/docs/aws/previous-generation/how-to/uninstalling.md.txt) before running `anthos-gke aws management delete`.

```bash
anthos-gke aws management delete DIRECTORY
```

## Optional flags

`[--force]`
:   Forces deletion of management service even if the user cannot connect to the
    management service.

### Positional arguments


`DIRECTORY`
:   An optional argument for the directory containing the
    `anthos-gke.yaml` file. Defaults to the current directory.

<br />

### Examples

To delete the management service defined in the current working directory, run
the following command:

```bash
anthos-gke aws management delete
```

To delete the management service defined in a specific directory, run the
following command:

```bash
anthos-gke aws management delete ~/example/workspace
```