AWS CLI 설치 for MacOs

2021. 8. 31. 15:18aws

1. macOS에서 AWS CLI 버전 2 패키지 설치

https://docs.aws.amazon.com/ko_kr/cli/latest/userguide/install-cliv2-mac.html

 

macOS에서 AWS CLI 버전 2 설치, 업데이트 및 제거 - AWS Command Line Interface

설치 관리자의 아무 위치에서나 Cmd+L을 눌러 설치에 대한 디버그 로그를 볼 수 있습니다. 이렇게 하면 로그를 필터링하고 저장할 수 있는 로그 창이 열립니다. 로그 파일도 /var/log/install.log에 자

docs.aws.amazon.com

 

2. pkg 설치

계속 및 설치를 클릭해 패키지를 설치한다.

 

3. SessionManagerPlugin 설치

aws cli로 접속하기 위해서 세션매니저플러그인을 설치한다.

https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html#install-plugin-macos

 

(Optional) Install the Session Manager plugin for the AWS CLI - AWS Systems Manager

(Optional) Install the Session Manager plugin for the AWS CLI If you want to use the AWS Command Line Interface (AWS CLI) to start and end sessions that connect you to your managed instances, you must first install the Session Manager plugin on your local

docs.aws.amazon.com

3- 1. Download the bundled installer.

curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/mac/sessionmanager-bundle.zip" -o "sessionmanager-bundle.zip"

3-2. Unzip the package.

unzip sessionmanager-bundle.zip

3-3. Run the install command.

sudo ./sessionmanager-bundle/install -i /usr/local/sessionmanagerplugin -b /usr/local/bin/session-manager-plugin
# help 조회
./sessionmanager-bundle/install -h

3-4. Verify that the installation was successful. For information, see Verify the Session Manager plugin installation. (필수 아님)

sudo rm -rf /usr/local/sessionmanagerplugin
sudo rm /usr/local/bin/session-manager-plugin

 

 

4. aws config

4-1. credentials 파일을 확인합니다.

# aws credentials 확인.
cat ~/.aws/credentials

4-2. 만약 아무것도 없다면 설정합니다.

4-2-1. 키 정보를 확인합니다.

IAM을 클릭한다.
사용자를 클릭한다.
해당 사용자를 클릭하여 보안 자격 증명을 들어간 뒤 액세스 키 ID를 확인합니다. 없다면 액세스 키 만들기를 한다.

4-2-2. aws configure 설정

aws configure

 

 

5. aws EC2에 접속하기

컴퓨팅 > EC2에 접속합니다.
인스턴스(실행 중)을 클릭합니다.
인스턴스들의 이름과 인스턴스ID를 확인합니다. (인스턴스ID가 중요)

// 해당 인스턴스에 ssh 처럼 접속
aws ssm start-session --target 인스턴스ID