|
| 1 | +--- |
| 2 | +display_name: Amazon Q |
| 3 | +description: Run Amazon Q in your workspace to access Amazon's AI coding assistant. |
| 4 | +icon: ../../../../.icons/aws.svg |
| 5 | +maintainer_github: coder |
| 6 | +verified: true |
| 7 | +tags: [ai, helper, amazon-q] |
| 8 | +--- |
| 9 | + |
| 10 | +# Amazon Q |
| 11 | + |
| 12 | +Run [Amazon Q](https://aws.amazon.com/q/) in your workspace to access Amazon's AI coding assistant. This module installs and launches Amazon Q, with support for background operation, task reporting, and custom pre/post install scripts. |
| 13 | + |
| 14 | +```tf |
| 15 | +module "amazon-q" { |
| 16 | + source = "registry.coder.com/coder/amazon-q/coder" |
| 17 | + version = "1.0.0" |
| 18 | + agent_id = coder_agent.example.id |
| 19 | + # Required: see below for how to generate |
| 20 | + experiment_auth_tarball = var.amazon_q_auth_tarball |
| 21 | +} |
| 22 | +``` |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | +## Prerequisites |
| 27 | + |
| 28 | +- You must generate an authenticated Amazon Q tarball on another machine: |
| 29 | + ```sh |
| 30 | + cd ~/.local/share/amazon-q && tar -c . | zstd | base64 -w 0 |
| 31 | + ``` |
| 32 | + Paste the result into the `experiment_auth_tarball` variable. |
| 33 | +- To run in the background, your workspace must have `screen` or `tmux` installed. |
| 34 | + |
| 35 | +<details> |
| 36 | +<summary><strong>How to generate the Amazon Q auth tarball (step-by-step)</strong></summary> |
| 37 | + |
| 38 | +**1. Install and authenticate Amazon Q on your local machine:** |
| 39 | + |
| 40 | +- Download and install Amazon Q from the [official site](https://aws.amazon.com/q/developer/). |
| 41 | +- Run `q login` and complete the authentication process in your terminal. |
| 42 | + |
| 43 | +**2. Locate your Amazon Q config directory:** |
| 44 | + |
| 45 | +- The config is typically stored at `~/.local/share/amazon-q`. |
| 46 | + |
| 47 | +**3. Generate the tarball:** |
| 48 | + |
| 49 | +- Run the following command in your terminal: |
| 50 | + ```sh |
| 51 | + cd ~/.local/share/amazon-q |
| 52 | + tar -c . | zstd | base64 -w 0 |
| 53 | + ``` |
| 54 | + |
| 55 | +**4. Copy the output:** |
| 56 | + |
| 57 | +- The command will output a long string. Copy this entire string. |
| 58 | + |
| 59 | +**5. Paste into your Terraform variable:** |
| 60 | + |
| 61 | +- Assign the string to the `experiment_auth_tarball` variable in your Terraform configuration, for example: |
| 62 | + ```tf |
| 63 | + variable "amazon_q_auth_tarball" { |
| 64 | + type = string |
| 65 | + default = "PASTE_LONG_STRING_HERE" |
| 66 | + } |
| 67 | + ``` |
| 68 | + |
| 69 | +**Note:** |
| 70 | + |
| 71 | +- You must re-generate the tarball if you log out or re-authenticate Amazon Q on your local machine. |
| 72 | +- This process is required for each user who wants to use Amazon Q in their workspace. |
| 73 | + |
| 74 | +[Reference: Amazon Q documentation](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/generate-docs.html) |
| 75 | + |
| 76 | +</details> |
| 77 | + |
| 78 | +## Examples |
| 79 | + |
| 80 | +### Run Amazon Q in the background with tmux |
| 81 | + |
| 82 | +```tf |
| 83 | +module "amazon-q" { |
| 84 | + source = "registry.coder.com/coder/amazon-q/coder" |
| 85 | + version = "1.0.0" |
| 86 | + agent_id = coder_agent.example.id |
| 87 | + experiment_auth_tarball = var.amazon_q_auth_tarball |
| 88 | + experiment_use_tmux = true |
| 89 | +} |
| 90 | +``` |
| 91 | + |
| 92 | +### Enable task reporting (experimental) |
| 93 | + |
| 94 | +```tf |
| 95 | +module "amazon-q" { |
| 96 | + source = "registry.coder.com/coder/amazon-q/coder" |
| 97 | + version = "1.0.0" |
| 98 | + agent_id = coder_agent.example.id |
| 99 | + experiment_auth_tarball = var.amazon_q_auth_tarball |
| 100 | + experiment_report_tasks = true |
| 101 | +} |
| 102 | +``` |
| 103 | + |
| 104 | +### Run custom scripts before/after install |
| 105 | + |
| 106 | +```tf |
| 107 | +module "amazon-q" { |
| 108 | + source = "registry.coder.com/coder/amazon-q/coder" |
| 109 | + version = "1.0.0" |
| 110 | + agent_id = coder_agent.example.id |
| 111 | + experiment_auth_tarball = var.amazon_q_auth_tarball |
| 112 | + experiment_pre_install_script = "echo Pre-install!" |
| 113 | + experiment_post_install_script = "echo Post-install!" |
| 114 | +} |
| 115 | +``` |
| 116 | + |
| 117 | +## Variables |
| 118 | + |
| 119 | +| Name | Required | Default | Description | |
| 120 | +| -------------------------------- | -------- | ------------------------ | ----------------------------------------------------------------------------------------------- | |
| 121 | +| `agent_id` | Yes | — | The ID of a Coder agent. | |
| 122 | +| `experiment_auth_tarball` | Yes | — | Base64-encoded, zstd-compressed tarball of a pre-authenticated Amazon Q config directory. | |
| 123 | +| `install_amazon_q` | No | `true` | Whether to install Amazon Q. | |
| 124 | +| `amazon_q_version` | No | `latest` | Version to install. | |
| 125 | +| `experiment_use_screen` | No | `false` | Use GNU screen for background operation. | |
| 126 | +| `experiment_use_tmux` | No | `false` | Use tmux for background operation. | |
| 127 | +| `experiment_report_tasks` | No | `false` | Enable task reporting to Coder. | |
| 128 | +| `experiment_pre_install_script` | No | `null` | Custom script to run before install. | |
| 129 | +| `experiment_post_install_script` | No | `null` | Custom script to run after install. | |
| 130 | +| `icon` | No | `/icon/amazon-q.svg` | The icon to use for the app. | |
| 131 | +| `folder` | No | `/home/coder` | The folder to run Amazon Q in. | |
| 132 | +| `order` | No | `null` | The order determines the position of app in the UI presentation. | |
| 133 | +| `system_prompt` | No | See [main.tf](./main.tf) | The system prompt to use for Amazon Q. This should instruct the agent how to do task reporting. | |
| 134 | +| `ai_prompt` | No | See [main.tf](./main.tf) | The initial task prompt to send to Amazon Q. | |
| 135 | + |
| 136 | +## Notes |
| 137 | + |
| 138 | +- Only one of `experiment_use_screen` or `experiment_use_tmux` can be true at a time. |
| 139 | +- If neither is set, Amazon Q runs in the foreground. |
| 140 | +- For more details, see the [main.tf](./main.tf) source. |
0 commit comments