MacOS 또는 Linux에서 Amazon AWS CLI(명령줄 인터페이스)를 설정하는 방법은 무엇입니까?
게시 됨: 2019-05-11
Amazon AWS
가 가장 큰 퍼블릭 클라우드 제공업체임에는 의심의 여지가 없습니다. 저는 개인적으로 Crunchify의 클라이언트 중 일부를 위해 Amazon AWS를 사용하기 시작했으며 AWS는 매우 유연합니다.
저는 모든 개발 활동에 Macbook Pro
를 사용합니다. 프로젝트에 Amazon AWS 클라우드를 사용하기로 결정했다면 가장 먼저 Amazon CLI(명령줄 인터페이스)를 설치하여 기본 Amazon AWS 작업 자동화를 시작해야 합니다.

이 자습서에서는 macOS에 Amazon CLI
를 설치하는 단계를 살펴보겠습니다.
아래 질문 중 하나가 있으면 올바른 위치에 있습니다.
- Mac에 amazon AWS cli 설치
- AWS CLI 시작하기 – AWS 명령줄 인터페이스
- macOS에서 AWS CLI 버전 1 또는 2 설치, 업데이트 및 제거
- AWS 명령줄 인터페이스 – Amazon AWS
- Macbook Pro에 AWS CLI를 설치하려면 어떻게 해야 합니까?
- macOS 설치 Amazon AWS 명령줄 인터페이스(CLI) 도구
시작하자:
MacOS에서 Amazon AWS CLI를 설정할 수 있는 두 가지 방법이 있습니다.
- 옵션-1:
curl
명령 사용 - 옵션-2: 간단한 Python
pip
명령 사용
옵션-1: curl 명령 사용

Amazon AWS CLI 버전 2 다운로드
1 |
bash - 3.2 $ $ curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" - o "AWSCLIV2.pkg" |
자세한 로그는 다음과 같습니다.
1 2 3 4 5 6 |
bash - 3.2 $ $ curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" - o "AWSCLIV2.pkg" bash : $ : command not found bash - 3.2 $ curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" - o "AWSCLIV2.pkg" % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 26.2M 100 26.2M 0 0 15.9M 0 0 : 00 : 01 0 : 00 : 01 -- : -- : -- 16.0M |
다음은 /
폴더 아래에 설치하는 명령입니다.
1 2 3 4 5 6 7 |
bash - 3.2 $ sudo installer - pkg AWSCLIV2 . pkg - target / Password : installer : Package name is AWS Command Line Interface installer : Installing at base path / installer : The install was successful . |
Amazon AWS 버전 확인:
1 2 3 |
bash - 3.2 $ aws -- version aws - cli / 2.4.16 Python / 3.8.8 Darwin / 21.4.0 exe / x86_64 prompt / off |
이것은 MacOS에 Amazon AWS CLI를 설치하는 가장 간단한 방법입니다. 설치하는 데 문제가 있으면 알려주십시오.
옵션-2: Python pip 명령 사용
1 단계.
시스템에 파이썬이 설치되어 있는지 확인하십시오.
1 2 |
bash - 3.2 $ python -- version Python 3.7.2 |
최신 버전의 Python이 표시되지 않으면 아래 명령을 사용하여 설치하십시오.
1 |
bash - 3.2 $ brew install python |
2 단계.
최신 Amazon AWS CLI 번들을 다운로드합니다.
1 2 3 4 |
bash - 3.2 $ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" - o "awscli-bundle.zip" % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 11.1M 100 11.1M 0 0 5598k 0 0 : 00 : 02 0 : 00 : 02 -- : -- : -- 5600k |
3단계.
awscli-bundle.zip
의 압축을 풉니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
bash - 3.2 $ unzip awscli - bundle . zip Archive : awscli - bundle . zip replace awscli - bundle / install ? [ y ] es , [ n ] o , [ A ] ll , [ N ] one , [ r ] ename : A inflating : awscli - bundle / install inflating : awscli - bundle / packages / botocore - 1.12.145.tar.gz inflating : awscli - bundle / packages / futures - 3.2.0.tar.gz inflating : awscli - bundle / packages / docutils - 0.14.tar.gz inflating : awscli - bundle / packages / virtualenv - 15.1.0.tar.gz inflating : awscli - bundle / packages / urllib3 - 1.22.tar.gz inflating : awscli - bundle / packages / rsa - 3.4.2.tar.gz inflating : awscli - bundle / packages / urllib3 - 1.24.3.tar.gz inflating : awscli - bundle / packages / ordereddict - 1.1.tar.gz inflating : awscli - bundle / packages / simplejson - 3.3.0.tar.gz inflating : awscli - bundle / packages / s3transfer - 0.2.0.tar.gz inflating : awscli - bundle / packages / python - dateutil - 2.6.1.tar.gz inflating : awscli - bundle / packages / jmespath - 0.9.4.tar.gz inflating : awscli - bundle / packages / PyYAML - 3.13.tar.gz inflating : awscli - bundle / packages / argparse - 1.2.1.tar.gz inflating : awscli - bundle / packages / pyasn1 - 0.4.5.tar.gz inflating : awscli - bundle / packages / colorama - 0.3.9.tar.gz inflating : awscli - bundle / packages / python - dateutil - 2.8.0.tar.gz inflating : awscli - bundle / packages / awscli - 1.16.155.tar.gz inflating : awscli - bundle / packages / six - 1.12.0.tar.gz inflating : awscli - bundle / packages / setup / setuptools_scm - 1.15.7.tar.gz |
4단계.
설치 프로그램을 sudoer
로 실행합니다.
1 2 3 4 5 6 7 8 |
bash - 3.2 $ sudo . / awscli - bundle / install - i / usr / local / aws - b / usr / local / bin / aws Password : Running cmd : / usr / bin / python virtualenv . py -- no - download -- python / usr / bin / python / usr / local / aws Running cmd : / usr / local / aws / bin / pip install -- no - cache - dir -- no - index -- find - links file : ///Users/crunchify/Documents/ansible/awscli-bundle/packages/setup setuptools_scm-1.15.7.tar.gz Running cmd : / usr / local / aws / bin / pip install -- no - cache - dir -- no - index -- find - links file : ///Users/crunchify/Documents/ansible/awscli-bundle/packages awscli-1.16.155.tar.gz Symlink already exists : / usr / local / bin / aws Removing symlink . You can now run : / usr / local / bin / aws -- version |
5단계.
검증. Amazon CLI가 성공적으로 설치되었는지 확인하는 방법은 무엇입니까?
1 2 |
bash - 3.2 $ aws -- version aws - cli / 1.16.155 Python / 2.7.10 Darwin / 18.5.0 botocore / 1.12.145 |
그게 다야 당신 준비 다 됐어요. Amazon CLI is successfully installed now
.
Amazon AWS 콘솔 및 AWS CLI 설정:
- 이동:
https://console.aws.amazon.com/iam/home?#/users
- 사용자 생성

권한 설정

Amazon AWS 액세스 키 ID, 보안 액세스 키 다운로드

aws configure
명령을 입력하기만 하면 됩니다. Amazon 액세스 키 ID와 보안 액세스 키를 입력합니다.
1 2 3 4 5 |
bash - 3.2 $ aws configure AWS Access Key ID [ **************** QTOR ] : AWS Secret Access Key [ **************** 4taa ] : Default region name [ us - east - 2 ] : Default output format [ json ] : |
모든 준비가 완료되었습니다. Amazon AWS CLI를 성공적으로 설정했습니다.
첫 번째 Amazon AWS CLI 명령을 실행합니다.

위에서 볼 수 있듯이 one Amazon EC2 instance
가 실행 중이며 describe-instances
명령을 사용하여 인스턴스에 대한 모든 세부 정보를 가져옵니다.
bash-3.2$ aws ec2 describe-instances
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
{ "Reservations" : [ { "Instances" : [ { "Monitoring" : { "State" : "disabled" } , "PublicDnsName" : "" , "StateReason" : { "Message" : "Client.UserInitiatedShutdown: User initiated shutdown" , "Code" : "Client.UserInitiatedShutdown" } , "State" : { "Code" : 48 , "Name" : "terminated" } , "EbsOptimized" : false , "LaunchTime" : "2019-05-09T12:33:20.000Z" , "ProductCodes" : [ ] , "CpuOptions" : { "CoreCount" : 1 , "ThreadsPerCore" : 1 } , "StateTransitionReason" : "User initiated (2019-05-10 15:33:23 GMT)" , "InstanceId" : "i-02f2a6661658d3ef2" , "EnaSupport" : true , "ImageId" : "ami-06088b0de148c2bac" , "PrivateDnsName" : "" , "KeyName" : "crunchify" , "SecurityGroups" : [ ] , "ClientToken" : "" , "InstanceType" : "t2.micro" , "CapacityReservationSpecification" : { "CapacityReservationPreference" : "open" } , "NetworkInterfaces" : [ ] , "Placement" : { "Tenancy" : "default" , "GroupName" : "" , "AvailabilityZone" : "us-east-2a" } , "Hypervisor" : "xen" , "BlockDeviceMappings" : [ ] , "Architecture" : "x86_64" , "RootDeviceType" : "ebs" , "RootDeviceName" : "/dev/sda1" , "VirtualizationType" : "hvm" , "Tags" : [ { "Value" : "worker" , "Key" : "Name" } ] , "HibernationOptions" : { "Configured" : false } , "AmiLaunchIndex" : 0 } , { "Monitoring" : { "State" : "disabled" } , "PublicDnsName" : "ec2-18-188-240-188.us-east-2.compute.amazonaws.com" , "State" : { "Code" : 16 , "Name" : "running" } , "EbsOptimized" : false , "LaunchTime" : "2019-05-09T12:33:20.000Z" , "PublicIpAddress" : "18.188.240.188" , "PrivateIpAddress" : "172.31.1.223" , "ProductCodes" : [ ] , "VpcId" : "vpc-8b4655e3" , "CpuOptions" : { "CoreCount" : 1 , "ThreadsPerCore" : 1 } , "StateTransitionReason" : "" , "InstanceId" : "i-0e19bc4bb04173c6a" , "EnaSupport" : true , "ImageId" : "ami-06088b0de148c2bac" , "PrivateDnsName" : "ip-172-31-1-223.us-east-2.compute.internal" , "KeyName" : "crunchify" , "SecurityGroups" : [ { "GroupName" : "launch-wizard-4" , "GroupId" : "sg-06bd2ee5d14e38797" } ] , "ClientToken" : "" , "SubnetId" : "subnet-c2447faa" , "InstanceType" : "t2.micro" , "CapacityReservationSpecification" : { "CapacityReservationPreference" : "open" } , "NetworkInterfaces" : [ { "Status" : "in-use" , "MacAddress" : "02:e4:a8:93:ad:56" , "SourceDestCheck" : true , "VpcId" : "vpc-8b4655e3" , "Description" : "" , "NetworkInterfaceId" : "eni-0b57a08339236e849" , "PrivateIpAddresses" : [ { "PrivateDnsName" : "ip-172-31-1-223.us-east-2.compute.internal" , "PrivateIpAddress" : "172.31.1.223" , "Primary" : true , "Association" : { "PublicIp" : "18.188.240.188" , "PublicDnsName" : "ec2-18-188-240-188.us-east-2.compute.amazonaws.com" , "IpOwnerId" : "amazon" } } ] , "PrivateDnsName" : "ip-172-31-1-223.us-east-2.compute.internal" , "InterfaceType" : "interface" , "Attachment" : { "Status" : "attached" , "DeviceIndex" : 0 , "DeleteOnTermination" : true , "AttachmentId" : "eni-attach-06cb447cd085d5818" , "AttachTime" : "2019-05-09T12:33:20.000Z" } , "Groups" : [ { "GroupName" : "launch-wizard-4" , "GroupId" : "sg-06bd2ee5d14e38797" } ] , "Ipv6Addresses" : [ ] , "OwnerId" : "600038600370" , "PrivateIpAddress" : "172.31.1.223" , "SubnetId" : "subnet-c2447faa" , "Association" : { "PublicIp" : "18.188.240.188" , "PublicDnsName" : "ec2-18-188-240-188.us-east-2.compute.amazonaws.com" , "IpOwnerId" : "amazon" } } ] , "SourceDestCheck" : true , "Placement" : { "Tenancy" : "default" , "GroupName" : "" , "AvailabilityZone" : "us-east-2a" } , "Hypervisor" : "xen" , "BlockDeviceMappings" : [ { "DeviceName" : "/dev/sda1" , "Ebs" : { "Status" : "attached" , "DeleteOnTermination" : true , "VolumeId" : "vol-077e7eb58ca59daea" , "AttachTime" : "2019-05-09T12:33:20.000Z" } } ] , "Architecture" : "x86_64" , "RootDeviceType" : "ebs" , "RootDeviceName" : "/dev/sda1" , "VirtualizationType" : "hvm" , "Tags" : [ { "Value" : "Crunchify" , "Key" : "Name" } ] , "HibernationOptions" : { "Configured" : false } , "AmiLaunchIndex" : 1 } ] , "ReservationId" : "r-00163c475d0a29a3d" , "Groups" : [ ] , "OwnerId" : "600038600370" } ] } |
그리고 그게 다야. 당신 준비 다 됐어요. 아래 작업을 모두 성공적으로 수행했습니다.

- Amazon AWS CLI 설치
- Amazon AWS CLI 설정
- 첫 번째 명령을 실행하고 결과를 얻었습니다.
AWS AWS CLI 명령을 실행하는 데 문제가 있으면 알려주십시오.