Install and configure IaC Code

Updated at:

This topic explains the common installation and configuration flow for IaC Code, including the Python environment, Windows Git Bash, optional dependencies, model services, and Alibaba Cloud identity. Once completed, REPL, Headless, and Web can all reuse the same configuration.

Prerequisites

Item

Requirement

Python

Version 3.10 or later. Recommended to use a virtual environment that is dedicated to your project.

Operating system

macOS, Linux, or Windows.

LLM service

An LLM service that IaC Code supports, and its access credentials.

Alibaba Cloud identity

Optional for local solution design or file processing. Required for query or managing cloud resources.

Additional requirement for Windows

Git for Windows provides the Git Bash required for tool execution.

You do not need LLM service or Alibaba Cloud credentials to install the package. In examples, do not include real API keys, AccessKey Secrets, or access tokens.

Install the base package

Run the following command:

python -m pip install iac-code

Verify the command and the version:

iac-code --help
iac-code --version

Expected result: the terminal displays the command help and the current version number of IaC Code. The base package provides the core capablities, including REPL, Headless, and ACP Stdio.

Install Git Bash on Windows

If Git for Windows is not installed, run the following command in PowerShell or the command prompt:

iac-code install-git-bash

This command runs only on Windows, and it downloads the installer from npmmirror. Follow the on-screen instructions to complete the installation and allow the required User Account Control (UAC) operations. After the installation finishes, the command detects bash.exe again and prints its path.

If enterprise network policies restrict the quick installation, use the following command instead:

winget install --id Git.Git -e --source winget

You can also install Git for Windows manually.

Install optional capabilities

Install an optional capability when you need runtime modes beyond the base package:

Optional capability

Installation command

Web version

python -m pip install "iac-code[http]"

A2A Server

python -m pip install "iac-code[a2a]"

Web version and A2A Server

python -m pip install "iac-code[http,a2a]"

If you start the Web version or the A2A Server before its optional capability is installed, IaC Code reports the package extra that you must install.

Configure the LLM service and Alibaba Cloud identity

The model configuration in IaC Code provides access to your LLM service. The Alibaba Cloud identity is used to query, deploy, update, or delete cloud services, specifications, stacks, and resources in your account.

Choose a configuration entry point

Configuration entry point

How to configure

Scenarios

REPL

Run iac-code and enter /auth.

You already work in a terminal, or you plan to use Headless, ACP, or A2A.

Web version

Open Settings > Model and Settings > Cloud Credentials.

You want to complete the configuration visually in a browser.

Both entry points write to the same configuration directory, so you do not need to configure the settings twice. For the complete Web form procedure, see Use the Web version. For the REPL authentication process, see Use REPL interactive mode.

Choose an Alibaba Cloud authentication method

Choose the authentication method that grants the least privilege in your runtime environment:

Authentication method

Scenarios

OAuth browser logon

Local interactive use when you want to avoid managing a long-term AccessKey pair manually.

ECS RAM role

IaC Code runs on an ECS instance.

Security Token Service (STS) token

An automation system provides temporary credentials.

RAM role

You use one identity to act the target RAM role.

AccessKey pair

None of the other methods apply. Use the AccessKey pair of a RAM user that has the least privilege.

Do not use the long-term AccessKey pair of your Alibaba Cloud account. Manage the permissions that are required to create, update, and delete cloud resources separately from read-only query permissions.

Configuration files and security

The default configuration directory is:

~/.iac-code/
├── .credentials.yml          # LLM service credentials
├── .cloud-credentials.yml    # Alibaba Cloud credentials
└── settings.yml              # Run settings

To change the configuration directory, set the IAC_CODE_CONFIG_DIR environment variable. IaC Code then uses the new directory for run data as well, including projects, sessions, Skill, MCP, memory, and logs.

Follow these security requirements:

  • Do not commit credential files to a code repository, and do not expose a real API key, AccessKey secret, or access token in commands, prompts, or logs.

  • Restrict operating system access permissions on the configuration directory and the credential files.

  • In automation environments, inject temporary credentials through a secret management service instead of writing secrets into scripts.

  • Rotate credentials on a regular basis, and revoke identities and permissions that are no longer used promptly.

Upgrade and uninstall

Upgrade IaC Code:

python -m pip install --upgrade iac-code

Uninstall IaC Code:

python -m pip uninstall iac-code

Uninstalling the package does not delete the configuration and sessions under ~/.iac-code/. Before you clean up the directory, make sure that no credentials, sessions, or project records need to be kept.

FAQ

The iac-code command is not found

Make sure that the Python installation used by the install command matches your current terminal environment, and check whether the Python scripts directory is in PATH. If you use a virtual environment, activate the environment before you run iac-code --help.

Windows still reports that Git Bash is not found

Run iac-code install-git-bash first. If Git for Windows is installed but IaC Code does not detect it, set the following variable in PowerShell:

$env:IAC_CODE_GIT_BASH_PATH = "C:\Program Files\Git\bin\bash.exe"

To keep the setting after you close the terminal, save the same configuration as a Windows user environment variable.

LLM service authentication fails

Make sure that the provider, the model name, the API base URL, and the API key match each other, and check the enterprise proxy and the connectivity to the target service. In the Web version, also make sure that the saved configuration is set as the current model.

Alibaba Cloud operations report insufficient permissions

Make sure that the authentication method, the credential validity period, and the region are correct, and grant the identity the minimum RAM permissions that the task requires. Do not work around a permission error by hardcoding the AccessKey pair of your Alibaba Cloud account.

References