# Unity Gaming Services CLI

> Use the Unity Gaming Services command-line tool to create, deploy, and manage Economy resources.

You can use the [Unity Gaming Services CLI](https://services.docs.unity.com/guides/ugs-cli/latest/general/overview) to interact with Economy resources.
The CLI allows you to create, deploy, and manage Economy resources from the command line.

## Prerequisites##prerequisites

For a deep dive into the CLI, follow the steps in the [Unity Gaming Services CLI Get Started guide](https://services.docs.unity.com/guides/ugs-cli/latest/general/get-started/install-the-cli/).

To follow this guide, you must first complete the following actions:

1. [Install the UGS CLI](https://services.docs.unity.com/guides/ugs-cli/latest/general/get-started/install-the-cli/).
2. Configure your Project ID and Environment as such:
   `ugs config set project-id <your-project-id>`
   `ugs config set environment-name <your-environment-name>`
3. Configure a Service Account with the required roles for [Economy](https://services.docs.unity.com/docs/service-account-auth/index.html#economy-resource-editor) and [environments management](https://services.docs.unity.com/docs/service-account-auth/index.html#unity-environments-admin). Refer to [Get Authenticated](https://services.docs.unity.com/guides/ugs-cli/latest/general/get-started/get-authenticated/).

## Using the CLI##using-the-cli

Refer to the [Economy Command Line documentation](https://services.docs.unity.com/guides/ugs-cli/latest/economy/Economy%20Command%20Line/overview/) for a full reference of all commands and options.

> **Note:**
>
> The `ugs economy` command is also available as `ugs ec`.

### Deploy resources##deploy-resources

Run the `new-file` command to create a resource locally:

```bash
ugs economy new-file <file-name>
```

You can use the `Deploy` command to promote your local resources to the remote environment and publish them at once.
The local resources must be deployed to become available to the game client.

```bash
ugs deploy <path-to-economy-file> <path-to-economy-file>
```

```bash
ugs deploy <path-to-directory>
```

### Retrieve resources##retrieve-resources

To retrieve information about the deployed resource, run the following command:

```bash
ugs economy get-resources
```

You can use the `Fetch` command to retrieve multiple Economy resources from the remote at once.
The provided path is a directory where the resources will be fetched to:

```bash
ugs fetch <path> --services economy
```

### Environment synchronization##environment-synchronization

You can move all your resources from one environment and deploy them to another environment.

Run the following command to produce an archive of all the resources in your current environment:

```bash
ugs fetch <out-dir> --services economy --environment-name <environment-from>
```

You can then deploy the resources to another environment by running the following command:

```bash
ugs deploy <in-dir> --services economy --environment-name <environment-to>
```

The resources are published as part of the deploy command.

### Delete resource##delete-resource

To delete an existing resource, run the following command:

```bash
ugs economy delete <resource-id>
```
