Windows에 AWS CLI를 설치했지만 WSL(Windows Subsystem for Linux)에서는 aws 명령어가 작동하지 않아 별도의 설치가 필요하다.
WSL 환경에 AWS CLI를 설치하고 기본 설정과 인증 테스트를 진행해보자.
📌내용
AWS CLI 설치 후 명령어 없음
처음에 Windows에만 AWS CLI를 설치했을 때 PowerShell, CMD, git bash에서는 잘 동작했지만 WSL에서 aws --version을 입력하자 command not found 오류가 발생했다.
이는 WSL이 독립적인 Linux 환경이기 때문이다.
아래와 같은 순서로 문제를 해결했다.
WSL에서 AWS CLI 다운로드 및 설치
curl, unzip 역시 별도의 설치가 필요하다.
AWS CLI가 주목적이므로 문서 하단에 정리한다.
AWS CLI를 다운로드 받아 설치한다.
1
2
3
4
5
6
7
8
9
10
11
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"# 실행 시 다운로드 % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 63.1M 100 63.1M 00 56.5M 0 0:00:01 0:00:01 --:--:-- 56.6M
# 다운로드 받은 파일 압축 해제 -> aws 폴더로 압축 해제된다.unzip awscliv2.zip
# 압축 해제된 폴더에서 install 실행sudo ./aws/install
설치 확인
1
2
3
aws --version
# 출력 예시aws-cli/2.16.1 Python/3.11.5 Linux/5.15.90.1-microsoft-standard-WSL2 exe/x86_64.ubuntu.20 prompt/off
자격 증명 및 기본 리전 설정
1
2
3
4
5
6
aws configure
# 입력을 요구한다AWS Access Key ID [None]: <AccessKey>
AWS Secret Access Key [None]: <SecretKey>
Default region name [None]: ap-northeast-2
Default output format [None]: json
설정 확인
1
2
3
4
5
6
7
8
aws configure list
# 출력 예시 Name Value Type Location
---- ----- ---- --------
profile <not set> None None
access_key ****************DW73 shared-credentials-file
secret_key ****************KVdy shared-credentials-file
region ap-northeast-2 config-file ~/.aws/config