{"id":135,"date":"2018-07-06T20:26:35","date_gmt":"2018-07-06T20:26:35","guid":{"rendered":"http:\/\/cloudygeek.com\/?p=135"},"modified":"2018-11-02T00:39:09","modified_gmt":"2018-11-02T00:39:09","slug":"favorite-aws-cli-commands","status":"publish","type":"post","link":"https:\/\/cloudygeek.com\/?p=135","title":{"rendered":"Favorite AWS Cli command(s)"},"content":{"rendered":"<ul>\n<li><strong>This will copy all the objects from one S3 bucket to another &#8212;<\/strong><\/li>\n<\/ul>\n<p><em>aws s3 cp s3:\/\/<strong>bucket1<\/strong> s3:\/\/<strong>bucket2<\/strong>\u00a0 &#8211;recursive\u00a0 \u00a0&#8211;grants read=uri=http:\/\/acs.amazonaws.com\/groups\/global\/AllUsers full=emailaddress=<strong>awsaccountemailaddress<\/strong><\/em><\/p>\n<p>*if bucket2 is in a different AWS account, it will need a bucket policy allowing bucket1 user to write to it.<\/p>\n<ul>\n<li><strong><strong>This will list running instances&#8217; instanceID, privateIP, and Tag=Name &#8212;<br \/>\n<\/strong><\/strong><em style=\"font-size: 1rem;\"><em style=\"font-size: 1rem;\"><em style=\"font-size: 1rem;\"><br \/>\naws ec2 describe-instances &#8211;filters &#8220;Name=instance-state-code&#8221;,&#8221;Values=16&#8243; &#8211;query &#8220;Reservations[*].Instances[*].[InstanceId, PrivateIpAddress, Tags[?Key==&#8217;Name&#8217;].Value | [0]]&#8221; &#8211;output table &#8211;region us-east-1 &#8211;profile production<\/p>\n<p><\/em><\/em><\/em><\/li>\n<li><strong>This will export running instances&#8217;\u00a0 InstanceID, InstanceType, Tag=Name, Tag=Project to a .tsv file (linux) which Excel will be able to open &#8212;<\/strong><\/li>\n<\/ul>\n<p class=\"p1\"><em><span class=\"s1\">aws ec2 describe-instances &#8211;output text &#8211;filters &#8220;Name=instance-state-code&#8221;,&#8221;Values=16&#8243; &#8211;query &#8216;Reservations[*].Instances[*].[InstanceId, InstanceType,<span class=\"Apple-converted-space\">\u00a0 <\/span>[Tags[?Key==`Name`].Value] [0][0], [Tags[?Key==`Project`].Value] [0][0]]&#8217; &gt; test.tsv<\/span><\/em><\/p>\n<p><!--more--><\/p>\n<ul>\n<li><strong>This will decode an AWS error &#8212;<\/strong><\/li>\n<\/ul>\n<p><span class=\"s1\"><em>aws sts decode-authorization-message &#8211;encoded-message <strong>&lt;superlongcrypticmessage&gt;<\/strong><\/em><br \/>\n<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This will copy all the objects from one S3 bucket to another &#8212; aws s3 cp s3:\/\/bucket1 s3:\/\/bucket2\u00a0 &#8211;recursive\u00a0 \u00a0&#8211;grants read=uri=http:\/\/acs.amazonaws.com\/groups\/global\/AllUsers full=emailaddress=awsaccountemailaddress *if bucket2 is in a different AWS account, it will need a bucket policy allowing bucket1 user to write to it. This will list running instances&#8217; instanceID, privateIP, and Tag=Name &#8212; aws ec2 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/cloudygeek.com\/?p=135\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Favorite AWS Cli command(s)&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/cloudygeek.com\/index.php?rest_route=\/wp\/v2\/posts\/135"}],"collection":[{"href":"https:\/\/cloudygeek.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudygeek.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudygeek.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudygeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=135"}],"version-history":[{"count":21,"href":"https:\/\/cloudygeek.com\/index.php?rest_route=\/wp\/v2\/posts\/135\/revisions"}],"predecessor-version":[{"id":161,"href":"https:\/\/cloudygeek.com\/index.php?rest_route=\/wp\/v2\/posts\/135\/revisions\/161"}],"wp:attachment":[{"href":"https:\/\/cloudygeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudygeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudygeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}