{"id":2745,"date":"2018-08-22T20:32:25","date_gmt":"2018-08-22T20:32:25","guid":{"rendered":"http:\/\/blog.paranoidprofessor.com\/?p=2745"},"modified":"2018-08-22T20:32:25","modified_gmt":"2018-08-22T20:32:25","slug":"aws-cli","status":"publish","type":"post","link":"https:\/\/blog.paranoidprofessor.com\/index.php\/2018\/08\/22\/aws-cli\/","title":{"rendered":"AWS &#8211; CLI"},"content":{"rendered":"<p>I am rather a command line person myself so in retrospect I was a bit surprised that I didn&#8217;t leap to the AWSCLI command line program.\u00a0 This tool lets you do from your shell what you might have had to do with various AWS screens.<\/p>\n<h2>Not quite intuitive<\/h2>\n<p>The <a href=\"http:\/\/docs.aws.amazon.com\/cli\/latest\/userguide\/installing.html\">AWS documentation makes it look pretty simple<\/a>.\u00a0 Just type the following command.<\/p>\n<pre>pip install awscli --upgrade --user<\/pre>\n<p>This actually does make the assumption that you already have python and pip installed on your machine.<\/p>\n<p>I am not a python developer but it sounded like this would all be a downhill slide as pip actually already comes installed with python since 3.4.<\/p>\n<p>I did have some false starts for a lot of reasons.\u00a0 The first is that if you are installing this on windows you should take the windows install package.\u00a0 It may have been an error but I tried the 64 bit embedded version which did not seem to have pip, nor did the 32 bit embedded version. I was a bit disappointed but i then tried a windows install that still didn&#8217;t quite work.<\/p>\n<p>This was probably my fault as I assumed that this was some sort command to be interpreted by the python interpreter &#8211; nope. If you do that, you will end up watching youtube videos and reading webpages that basically lead you in the wrong direction.<\/p>\n<p>Eventually I found the correct web page that pointed out that the pip command is essentially an external program that needs to be run, just as seen above.<\/p>\n<p>However, I found this out after reverting to python 3.5.4 and making sure that both the installed directory as well as its Scripts sub-directory was in the path.\u00a0 Yup, that makes everything work a lot easier.\u00a0 But I am not really willing to install the more up to date 3.6.3 python &#8211; well at the moment.<\/p>\n<h2>AWSCLI<\/h2>\n<p>Well, the aws command is exactly like the pip command, you simply run this from the command line and then everything works just fine, well, sorta.<\/p>\n<p>You need to first do one little configuration and<a href=\"http:\/\/docs.aws.amazon.com\/cli\/latest\/userguide\/cli-multiple-profiles.html?shortFooter=true\" target=\"_blank\" rel=\"noopener\"> amazon again does step you through it<\/a>.\u00a0 Of course you do need to either setup a user in the IAM or use an existing user with the necessary privilages.<\/p>\n<pre>aws configure<\/pre>\n<p>You will be asked four questions and most of these answers are already available from the IAM. What I thought would be the tricky question was what is my aws_access_key_id and the aws_secret_access_key.\u00a0 The other questions seem pretty tame, what format do you want you output and what region are you in.<\/p>\n<p>I got the hard part right but somehow got my region wrong.\u00a0 My attempts to manually fix these two files (.aws\/credentialls and .aws\/config) only seemed to make things worse.\u00a0 My example command seemed simple enough.<\/p>\n<pre>aws ec2 describe-instances<\/pre>\n<p>I either ended up having some fairly odd problems with the explanation that my profile could not be found or the program would hang. In the end, I could not manuallly fix these files so I simply deleted the two configuration files and re-ran the configure with a minor change.<\/p>\n<pre>aws configure --profile myuser<\/pre>\n<p>This worked a lot better and then my test program almost worked.\u00a0 I realized\u00a0that I was running my test using a different region (Frankfurt) versus what I should have been US East (Ohio).<\/p>\n<p>I think that I was saved by that mistake.\u00a0 Once I changed my region I started to get a much more reasonable error.<\/p>\n<pre>Invalid endpoint: https:\/\/ec2.us east.amazonaws.com<\/pre>\n<p>Yes, I made a pretty bad guess at my region but it did help to yield this very badly formatted URL and google came to my assistance.\u00a0 I turned out that I was nowhere near correct with my region name<\/p>\n<blockquote>\n<h3>(quick side rant)<\/h3>\n<p>The amazon documentation has a hyperlink everywhere when you are reading about almost any topic.\u00a0 It is almost impossible to go through from start to end on a topic without visiting a dozen other document links.\u00a0 Guess how many links about regions they had on this page.\u00a0 Yup, none.<\/p><\/blockquote>\n<p>Anyway, Amazon also has a <a href=\"http:\/\/docs.aws.amazon.com\/general\/latest\/gr\/rande.html\" target=\"_blank\" rel=\"noopener\">list of all of their regions<\/a> which was very helpful.\u00a0 I changed my region to one from this list and then my aws test command worked.<\/p>\n<p>I never got a chance to get back to my studies of Aws Lambda, but I will get to that in the morning.<\/p>\n<p>&nbsp;<\/p>\n<h2>Python<\/h2>\n<p><a href=\"https:\/\/www.python.org\/downloads\/release\/python-354\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.python.org\/downloads\/release\/python-354\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am rather a command line person myself so in retrospect I was a bit surprised that I didn&#8217;t leap to the AWSCLI command line program.\u00a0 This tool lets you do from your shell what you might have had to &hellip; <a href=\"https:\/\/blog.paranoidprofessor.com\/index.php\/2018\/08\/22\/aws-cli\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[95,90,85],"_links":{"self":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/2745"}],"collection":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/comments?post=2745"}],"version-history":[{"count":1,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/2745\/revisions"}],"predecessor-version":[{"id":2746,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/2745\/revisions\/2746"}],"wp:attachment":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/media?parent=2745"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/categories?post=2745"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/tags?post=2745"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}