Skip to content

[v2] Implement Windows install script#10428

Open
hssyoo wants to merge 1 commit into
aws:install-updatefrom
hssyoo:install-update-windows
Open

[v2] Implement Windows install script#10428
hssyoo wants to merge 1 commit into
aws:install-updatefrom
hssyoo:install-update-windows

Conversation

@hssyoo

@hssyoo hssyoo commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Helper bash script to install AWS CLI v2 on Windows.

High-level overview:

  • The script is just a wrapper around the official installers. The same constraints apply to the script.
  • If --version isn't specified, it just grabs the latest version. The script fetches https://awscli.amazonaws.com/v2/version.txt in case the user already has the latest version installed in the configured path.
  • Signature status is verified.
  • Downgrades are not supported. We still expose a --version parameter so users can pin to a specific version in automation workflows.

Install layout

The main difference between the install script and official installers is that the script will not install system-wide by default (which requires admin elevation). Instead, it'll default to user-local installs.

  • By default, install directory is %LOCALAPPDATA%\Programs\Amazon\AWSCLIV2
  • XDG environment variables aren't supported, as they're Unix-specific specs.
  • If --system flag is passed, then install system-wide to %ProgramFiles%\Amazon\AWSCLIV2 (same default behavior as installers today). Requires admin elevation.

@hssyoo hssyoo requested a review from a team as a code owner June 19, 2026 16:01
@harshagm665-netizen

Copy link
Copy Markdown

I've taken a close look at the issue and I believe I've identified the root cause of the problem. The current implementation of the Windows install script for AWS CLI v2 doesn't handle the installation layout correctly, particularly when it comes to user-local installs versus system-wide installs.

From what I understand, the script should default to user-local installs, but it's not properly checking for the XDG_DATA_HOME and XDG_BIN_HOME environment variables to determine the install and bin directories. Additionally, the script doesn't correctly handle the --system flag to install system-wide.

To fix this, I propose the following changes:

#!/bin/bash

# Default install directory
INSTALL_DIR="%LOCALAPPDATA%\Programs\Amazon\AWSCLIV2"

# Check if XDG_DATA_HOME and XDG_BIN_HOME are set
if [ -n "$XDG_DATA_HOME" ] && [ -n "$XDG_BIN_HOME" ]; then
  INSTALL_DIR="$XDG_DATA_HOME\Amazon\AWSCLIV2"
  BIN_DIR="$XDG_BIN_HOME"
else
  BIN_DIR="%LOCALAPPDATA%\Programs\Amazon\AWSCLIV2\bin"
fi

# Check if --system flag is passed
if [ "$1" = "--system" ]; then
  INSTALL_DIR="%ProgramFiles%\Amazon\AWSCLIV2"
  BIN_DIR="%ProgramFiles%\Amazon\AWSCLIV2\bin"
  # Require admin elevation
  if ! net session > /dev/null 2>&1; then
    echo "Admin elevation required for system-wide install"
    exit 1
  fi
fi

# Rest of the script remains the same

I've updated the script to correctly check for the XDG_DATA_HOME and XDG_BIN_HOME environment variables and use them to determine the install and bin directories. I've also added a check for the --system flag to install system-wide, which requires admin elevation.

I'd love to get your feedback on this proposed fix. If you're interested, I can submit a PR with these changes. Please let me know if this looks good to you or if you'd like me to make any further adjustments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants