{
  "schema_version": 3,
  "id": "operate/iris/cloud-cli",
  "title": "Set up the CLI for Redis Cloud",
  "url": "https://redis.io/docs/latest/operate/iris/cloud-cli/",
  "summary": "Create and manage Redis Iris services on Redis Cloud from the iris CLI with a Redis Cloud API key pair.",
  "tags": [
    "docs",
    "operate",
    "iris"
  ],
  "last_updated": "2026-11-30T09:11:04-05:00",
  "page_type": "content",
  "content_hash": "dfa5ea831713ded0518601d4e8926dd11171a900d5cb016d974332852d7cc604",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "The `iris` command-line interface (CLI) in the [`redis-iris`](https://pypi.org/project/redis-iris/) package can create and manage Redis Iris services on Redis Cloud, as an alternative to the console. Use it to script setup, run it in continuous integration (CI), or let a coding agent do the setup for you. The console guides, such as [Create an Agent Memory service](https://redis.io/docs/latest/operate/iris/agent-memory/create-service), cover the same tasks in the console.\n\nThe CLI signs in with a Redis Cloud application programming interface (API) key pair rather than a console session. The steps match the [self-managed setup](https://redis.io/docs/latest/operate/iris/agent-memory/self-managed#create-a-store-with-the-cli-and-sdk), except that the keys come from the console and the profile needs no URLs."
    },
    {
      "id": "1-get-the-api-keys",
      "title": "1. Get the API keys",
      "role": "content",
      "text": "In the [Redis Cloud console](https://cloud.redis.io/), open **Access Management → API Keys**. The CLI needs two keys from this page:\n\n| Console label | Environment variable | What it does |\n| --- | --- | --- |\n| **API account key** | `REDIS_CLOUD_API_KEY` | Identifies your Redis Cloud account. There's one per account, shown at the top of the **API Keys** tab. If the tab shows **Enable API**, select it first. |\n| **API user key** | `REDIS_CLOUD_API_SECRET` | The secret. It acts as one user, with that user's role. Under **User keys**, select **Add**, name the key, and pick the user it acts as. The key is shown only once, so copy it before you close the dialog. |\n\nThe account key tells Redis Cloud which account the request is for, and the user key determines what the request is allowed to do. The CLI needs both. See [Manage API keys](https://redis.io/docs/latest/operate/rc/api/get-started/manage-api-keys) for more about the keys.\n\nA user key works for the whole account, including through the [Redis Cloud API](https://redis.io/docs/latest/operate/rc/api), and it doesn't expire. To limit what a leaked key can do:\n\n- Create the key for a dedicated user with the least-privileged role that can do the work, not for an account owner. Listing services needs less access than creating services.\n- Delete the key from **API Keys** when you no longer need it."
    },
    {
      "id": "2-install-the-cli",
      "title": "2. Install the CLI",
      "role": "content",
      "text": "[code example]"
    },
    {
      "id": "3-create-a-profile",
      "title": "3. Create a profile",
      "role": "content",
      "text": "Create `iris.toml` with a Redis Cloud profile:\n\n[code example]\n\nThe CLI sends requests to `https://cloud.redis.io` and finds every service URL from there. It sends the keys only over HTTPS (Hypertext Transfer Protocol Secure), and only to that host. A service URL on any other host is refused before any request is sent. Keys in `iris.toml` are refused."
    },
    {
      "id": "4-store-the-keys",
      "title": "4. Store the keys",
      "role": "content",
      "text": "Put the keys in `.env.cloud`, separate from your application's `.env`, so that your agent never receives your Redis Cloud keys:\n\n[code example]\n\nMake the file readable only by you, and load it:\n\n[code example]\n\nCheck the connection. This lists your Agent Memory services:\n\n[code example]"
    },
    {
      "id": "5-create-a-service",
      "title": "5. Create a service",
      "role": "content",
      "text": "This example creates an Agent Memory service. You need the ID of a Redis Cloud database that meets the [Agent Memory prerequisites](https://redis.io/docs/latest/operate/iris/agent-memory/create-service#prerequisites-and-limitations). List the account's databases and whether each one is eligible with `iris agent-memory databases list`.\n\n1. Do a dry run. It sends nothing:\n\n    [code example]\n\n1. Create the service. The CLI creates the store, mints its agent key, and writes `IRIS_AGENT_MEMORY_URL`, `IRIS_AGENT_MEMORY_STORE_ID`, and `IRIS_AGENT_MEMORY_API_KEY` to `.env` without printing the key:\n\n    [code example]\n\n    The key appears under **Iris → Access & Identity** in the console, like a key you create there.\n\n1. Check every hop, from the control plane to a read with the agent key:\n\n    [code example]\n\nYour application reads the same `.env`. With the Python software development kit (SDK):\n\n[code example]\n\nThe same profile works for the other services' commands, such as `iris agent-playbooks service list`, `iris context-gateway service list`, and `iris intent-router service list`."
    },
    {
      "id": "troubleshooting",
      "title": "Troubleshooting",
      "role": "errors",
      "text": "| Error | Cause | Fix |\n| --- | --- | --- |\n| `cloud_unsupported` | Neither key is set, so the CLI lists the console steps instead. | Load `.env.cloud`. |\n| `credential_required` | Only one of the two keys is set. | Set both `REDIS_CLOUD_API_KEY` and `REDIS_CLOUD_API_SECRET`. |\n| `input_error`, \"refusing to send the Redis Cloud keys\" | A service URL points at a host other than the console. | Remove the URL setting, so the CLI uses the console host. |\n| `unauthenticated` (HTTP status 401) | Redis Cloud rejected the keys: they're wrong or deleted, or the two keys come from different accounts. | Copy both keys again from **API Keys**. |\n| `forbidden` (HTTP status 403) | The user key's user doesn't have the role this command needs. | Create a user key for a user whose role can manage Iris. |"
    }
  ],
  "examples": [
    {
      "id": "2-install-the-cli-ex0",
      "language": "bash",
      "code": "pip install 'redis-iris>=1.3.0'",
      "section_id": "2-install-the-cli"
    },
    {
      "id": "3-create-a-profile-ex0",
      "language": "toml",
      "code": "[profiles.cloud]\nkind = \"cloud\"",
      "section_id": "3-create-a-profile"
    },
    {
      "id": "4-store-the-keys-ex0",
      "language": "bash",
      "code": "IRIS_CONFIG=./iris.toml\nIRIS_PROFILE=cloud\nREDIS_CLOUD_API_KEY=<api-account-key>\nREDIS_CLOUD_API_SECRET=<api-user-key>",
      "section_id": "4-store-the-keys"
    },
    {
      "id": "4-store-the-keys-ex1",
      "language": "bash",
      "code": "chmod 600 .env.cloud\nset -a; source .env.cloud; set +a",
      "section_id": "4-store-the-keys"
    },
    {
      "id": "4-store-the-keys-ex2",
      "language": "bash",
      "code": "iris agent-memory service list",
      "section_id": "4-store-the-keys"
    },
    {
      "id": "5-create-a-service-ex0",
      "language": "bash",
      "code": "iris agent-memory service create --name support-memory --database-id <database-id> --dry-run",
      "section_id": "5-create-a-service"
    },
    {
      "id": "5-create-a-service-ex1",
      "language": "bash",
      "code": "iris agent-memory service create --name support-memory --database-id <database-id> --write-env .env",
      "section_id": "5-create-a-service"
    },
    {
      "id": "5-create-a-service-ex2",
      "language": "bash",
      "code": "set -a; source .env.cloud; source .env; set +a\n    iris agent-memory service check \"$IRIS_AGENT_MEMORY_STORE_ID\" --env-file .env",
      "section_id": "5-create-a-service"
    },
    {
      "id": "5-create-a-service-ex3",
      "language": "python",
      "code": "from redis_iris import AgentMemory\n\nmemory = AgentMemory.from_env()",
      "section_id": "5-create-a-service"
    }
  ]
}
