{"id":488,"date":"2019-11-17T20:15:21","date_gmt":"2019-11-17T18:15:21","guid":{"rendered":"https:\/\/www.petersplanet.nl\/?p=488"},"modified":"2019-11-17T20:15:21","modified_gmt":"2019-11-17T18:15:21","slug":"how-to-use-ansible-on-a-local-workstation-with-amazon-aws","status":"publish","type":"post","link":"https:\/\/www.petersplanet.nl\/index.php\/2019\/11\/17\/how-to-use-ansible-on-a-local-workstation-with-amazon-aws\/","title":{"rendered":"How to use Ansible on a local workstation with Amazon AWS"},"content":{"rendered":"\n<p>To connect with Amazon AWS you need to use a key. Usually that key is protected with a password. Because it is not possible to use Ansible with a password protected key some configuration is necessary.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>I assume you are logging in to AWS with a Putty ppk-key. First we need to convert the Putty ppk-file into a format that OpenSSH understands. The result will be copied to  ~\/.ssh\/<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">puttygen mykeypair-eu-ie-sec.ppk -O private-openssh -o mykeypair-eu-ie-sec\nputtygen mykeypair-eu-ie-sec.ppk -O public-openssh -o mykeypair-eu-ie-sec.pub\nmv ~\/mykeypair-eu-ie-sec* ~\/.ssh\/\nchmod 600 ~\/.ssh\/mykeypair-eu-ie-sec\nchmod 664 ~\/.ssh\/mykeypair-eu-ie-sec.pub<\/pre>\n\n\n\n<p>Now edit or create the ~\/.ssh\/config file<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Host myserver.eu-west-1.compute.amazonaws.com   \n  ForwardAgent yes\n  IdentityFile ~\/.ssh\/mykeypair-eu-ie-sec<\/pre>\n\n\n\n<p>Next load the key in memory so that Ansible doesn&#8217;t have to ask for the passphrase of the key.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ssh-agent bash\nssh-add -L\nssh-add ~\/.ssh\/mykeypair-eu-ie-sec<\/pre>\n\n\n\n<p>Now you can use your local Ansible with servers on Amazon AWS. <\/p>\n\n\n\n<p>References:<br>&#8211; https:\/\/developer.github.com\/v3\/guides\/using-ssh-agent-forwarding\/ <\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>To connect with Amazon AWS you need to use a key. Usually that key is protected with a password. Because it is not possible to use Ansible with a password protected key some configuration is necessary.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,5],"tags":[],"class_list":["post-488","post","type-post","status-publish","format-standard","hentry","category-cloud","category-linux"],"_links":{"self":[{"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/posts\/488","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/comments?post=488"}],"version-history":[{"count":5,"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/posts\/488\/revisions"}],"predecessor-version":[{"id":493,"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/posts\/488\/revisions\/493"}],"wp:attachment":[{"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/media?parent=488"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/categories?post=488"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.petersplanet.nl\/index.php\/wp-json\/wp\/v2\/tags?post=488"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}