{"id":7618,"date":"2018-06-23T09:42:11","date_gmt":"2018-06-23T01:42:11","guid":{"rendered":"http:\/\/rmohan.com\/?p=7618"},"modified":"2018-06-23T09:42:11","modified_gmt":"2018-06-23T01:42:11","slug":"how-to-install-configure-aws-cli-linux-os-x-or-unix","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=7618","title":{"rendered":"How to Install Configure AWS CLI -Linux, OS X, or Unix"},"content":{"rendered":"<p>How to Install Configure AWS CLI -Linux, OS X, or Unix<br \/>\nAWS CLI (Command Line Interface)<\/p>\n<p>The AWS Command Line Interface is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts.<\/p>\n<p>Steps to Install AWS CLI (Linux, OS X, or Unix)<\/p>\n<p>Prerequisites<\/p>\n<p>1)Linux Machine<\/p>\n<p>2) Python above 2.6.5+<\/p>\n<p>Here my machine Details<\/p>\n<p>1)Fedora release 20 (Heisenbug) Linux rmohan 3.16.6-200.fc20.x86_64<\/p>\n<p>2)[root@rmohan ~]# python &#8211;version<br \/>\nPython 2.7.5<\/p>\n<p>Download the AWS CLI Bundled Installer<\/p>\n<p>[root@rmohan tmp]# wget https:\/\/s3.amazonaws.com\/aws-cli\/awscli-bundle.zip<\/p>\n<p>&#8211;2016-02-10 15:58:20&#8211; https:\/\/s3.amazonaws.com\/aws-cli\/awscli-bundle.zip<br \/>\nResolving s3.amazonaws.com (s3.amazonaws.com)&#8230; 54.231.81.252<br \/>\nConnecting to s3.amazonaws.com (s3.amazonaws.com)|54.231.81.252|:443&#8230; connected.<br \/>\nHTTP request sent, awaiting response&#8230; 200 OK<br \/>\nLength: 6678296 (6.4M) [application\/zip]<br \/>\nSaving to: \u2018awscli-bundle.zip\u2019<\/p>\n<p>awscli-bundle.zip 100%[========================================================&gt;] 6.37M 122KB\/s in 57s<\/p>\n<p>2016-02-10 15:59:18 (114 KB\/s) &#8211; \u2018awscli-bundle.zip\u2019 saved [6678296\/6678296]<\/p>\n<p>Unzip the package.<\/p>\n<p>[root@rmohan tmp]# unzip awscli-bundle.zip<br \/>\nArchive: awscli-bundle.zip<br \/>\ninflating: awscli-bundle\/install<br \/>\ninflating: awscli-bundle\/packages\/argparse-1.2.1.tar.gz<br \/>\ninflating: awscli-bundle\/packages\/awscli-1.10.3.tar.gz<br \/>\ninflating: awscli-bundle\/packages\/botocore-1.3.25.tar.gz<br \/>\ninflating: awscli-bundle\/packages\/colorama-0.3.3.tar.gz<br \/>\ninflating: awscli-bundle\/packages\/docutils-0.12.tar.gz<br \/>\ninflating: awscli-bundle\/packages\/futures-3.0.4.tar.gz<br \/>\ninflating: awscli-bundle\/packages\/jmespath-0.9.0.tar.gz<br \/>\ninflating: awscli-bundle\/packages\/ordereddict-1.1.tar.gz<br \/>\ninflating: awscli-bundle\/packages\/pyasn1-0.1.9.tar.gz<br \/>\ninflating: awscli-bundle\/packages\/python-dateutil-2.4.2.tar.gz<br \/>\ninflating: awscli-bundle\/packages\/rsa-3.3.tar.gz<br \/>\ninflating: awscli-bundle\/packages\/s3transfer-0.0.1.tar.gz<br \/>\ninflating: awscli-bundle\/packages\/simplejson-3.3.0.tar.gz<br \/>\ninflating: awscli-bundle\/packages\/six-1.10.0.tar.gz<br \/>\ninflating: awscli-bundle\/packages\/virtualenv-13.0.3.tar.gz<\/p>\n<p>Switch the Dir &amp; Install the same.<\/p>\n<p>[root@rmohan tmp]# cd awscli-bundle\/<\/p>\n<p>[root@rmohan awscli-bundle]# ll<br \/>\ntotal 8<br \/>\n-rwxr-xr-x 1 root root 4528 Feb 9 14:57 install<br \/>\ndrwxr-xr-x 2 root root 340 Feb 10 16:01 packages<\/p>\n<p>[root@rmohan awscli-bundle]# .\/install -i \/usr\/local\/aws -b \/usr\/local\/bin\/aws<br \/>\nRunning cmd: \/bin\/python virtualenv.py &#8211;python \/bin\/python \/usr\/local\/aws<br \/>\nRunning cmd: \/usr\/local\/aws\/bin\/pip install &#8211;no-index &#8211;find-links file:\/\/\/tmp\/awscli-bundle\/packages awscli-1.10.3.tar.gz<br \/>\nYou can now run: \/usr\/local\/bin\/aws &#8211;version<\/p>\n<p>Verify the same.<\/p>\n<p>[root@rmohan awscli-bundle]# aws &#8211;version<br \/>\naws-cli\/1.10.3 Python\/2.7.5 Linux\/3.16.6-200.fc20.x86_64 botocore\/1.3.25<\/p>\n<p>[rmohan@rmohan ~]$ aws help<\/p>\n<p>To Read Further Make sure AWS IAM in Place.<\/p>\n<p>Now time to Configuring AWS CLI<\/p>\n<p>[rmohan@rmohan ~]$ aws configure<br \/>\nAWS Access Key ID [None]: AKIA***********4OA<br \/>\nAWS Secret Access Key [None]: zdi*******************iZG2oej<br \/>\nDefault region name [None]: ap-southeast-1a<br \/>\nDefault output format [None]: json<\/p>\n<p>After this when i test it through me below error.<\/p>\n<p>[rmohan@rmohan ~]$ aws ec2 describe-instances<\/p>\n<p>Could not connect to the endpoint URL: &#8220;https:\/\/ec2.ap-southeast-1a.amazonaws.com\/&#8221;<\/p>\n<p>Fix :- region which i configured is wrong. only last with 1 not 1a.<\/p>\n<p>Open following file to fix.<\/p>\n<p>[rmohan@rmohan ~]$ vi .aws\/config<\/p>\n<p>[rmohan@rmohan ~]$ aws ec2 describe-instances<br \/>\n{<br \/>\n&#8220;Reservations&#8221;: []<br \/>\n}<\/p>\n<p>Two IMP Conf file..Just for ref.<\/p>\n<p>[rmohan@rmohan ~]$ cat .aws\/config<br \/>\n[default]<br \/>\noutput = json<br \/>\nregion = ap-southeast-1<\/p>\n<p>[rmohan@rmohan ~]$ cat .aws\/credentials<br \/>\n[default]<br \/>\naws_access_key_id = AKIA***********4OA<br \/>\naws_secret_access_key = zdi*******************iZG2oejT<\/p>\n<p>[rmohan@rmohan ~]$ aws ec2 create-security-group &#8211;group-name rk-sg &#8211;description &#8220;test security group&#8221;<br \/>\n{<br \/>\n&#8220;GroupId&#8221;: &#8220;sg-33777***56&#8221;<br \/>\n}<\/p>\n<p>Here you can find screen of GUI as well.<\/p>\n<p>[rmohan@rmohan ~]$ aws ec2 describe-instances &#8211;output table &#8211;region ap-southeast-1<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n|DescribeInstances|<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br \/>\nMore AWS CLI Command<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to Install Configure AWS CLI -Linux, OS X, or Unix AWS CLI (Command Line Interface)<\/p>\n<p>The AWS Command Line Interface is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts.<\/p>\n<p>Steps to [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[49],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7618"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7618"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7618\/revisions"}],"predecessor-version":[{"id":7619,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7618\/revisions\/7619"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7618"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7618"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7618"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}