{"id":1045,"date":"2014-09-04T19:05:15","date_gmt":"2014-09-04T19:05:15","guid":{"rendered":"http:\/\/www.nickbennett.co.uk\/?p=1045"},"modified":"2025-06-10T19:26:20","modified_gmt":"2025-06-10T19:26:20","slug":"deploying-to-aws-with-phing","status":"publish","type":"post","link":"https:\/\/blog.nickbennett.co.uk\/index.php\/2014\/09\/04\/deploying-to-aws-with-phing\/","title":{"rendered":"Deploying to AWS with Phing"},"content":{"rendered":"<p>After a recent switch to <strong>Amazon Web Services,<\/strong> I thought updating my <strong>Phing<\/strong> build XML would be a straightforward task. It wasn&#8217;t. There weren&#8217;t a lot of resources out there for this particular scenario so I decided to write this blog piece.<\/p>\n<p><strong>AWS<\/strong> comes with good security out of the box. This is obviously a good thing but it does require a bit more thought when setting up your <strong>Phing<\/strong> build file.<\/p>\n<p><strong>Filesync<\/strong><br \/>\nDuring the process of setting up your micro instance, you will be prompted to create an SSH private key which you can download. Put this file somewhere safe and ensure you update the permissions.<\/p>\n<p><code>    chmod 644 mykey.pem<br \/>\n<\/code>All deployment will be done using the <em>ec2-user<\/em> user. So to save frustration ensure that this user has the write permissions on your target directory (on your target box).<\/p>\n<p>Where my file sync previously prompted for a password the <strong>identityfile<\/strong>\u00a0parameter automatically connects to instance.<\/p>\n<p><code>        &lt;filesync<br \/>\n            sourcedir=\"${source.path}\"<br \/>\n            destinationdir=\"${target.user}@${target.host}:${target.path}\"<br \/>\n            verbose=\"true\"<br \/>\n            checksum=\"true\"<br \/>\n            excludeFile=\"${exclude.file}\"<br \/>\n            identityfile=\"${source.identityFile}\" \/&gt;<br \/>\n<\/code><strong>SCP\/SSH<\/strong><br \/>\nYou would think this would be the same as filesync. Unfortunately not. This requires you to create a public key using your private key. From the private key location run the following.<\/p>\n<p><code>    ssh-keygen -f mykey.pem -y &gt; mykey.pub<br \/>\n<\/code>Now in your build XML add these parameters<\/p>\n<p><code>        &lt;scp<br \/>\n            username=\"${target.user}\"<br \/>\n            privkeyfile=\"${source.identityFile}\"<br \/>\n            pubkeyfile=\"${source.pubIdentityFile}\"<br \/>\n            host=\"${target.host}\"<br \/>\n            todir=\"${target.path}\/mytargetpath\"<br \/>\n            autocreate=\"true\"<br \/>\n            file=\"${source.path}\/local.txt\" \/&gt;<br \/>\n<\/code>You should be good to go. Hope this is useful.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After a recent switch to Amazon Web Services, I thought updating my Phing build XML would be a straightforward task. It wasn&#8217;t. There weren&#8217;t a lot of resources out there for this particular scenario so I decided to write this blog piece. AWS comes with good security out of the box. This is obviously a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1051,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,8,12],"tags":[45,130,161,241,324,326,339,346,382,408],"class_list":["post-1045","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-archetecture","category-php","category-technology","tag-aws","tag-deployment","tag-filesync","tag-keys","tag-phing","tag-php","tag-private","tag-public","tag-scp","tag-ssh"],"_links":{"self":[{"href":"https:\/\/blog.nickbennett.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/1045","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.nickbennett.co.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.nickbennett.co.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.nickbennett.co.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.nickbennett.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=1045"}],"version-history":[{"count":2,"href":"https:\/\/blog.nickbennett.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/1045\/revisions"}],"predecessor-version":[{"id":1432,"href":"https:\/\/blog.nickbennett.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/1045\/revisions\/1432"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.nickbennett.co.uk\/index.php\/wp-json\/wp\/v2\/media\/1051"}],"wp:attachment":[{"href":"https:\/\/blog.nickbennett.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=1045"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.nickbennett.co.uk\/index.php\/wp-json\/wp\/v2\/categories?post=1045"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.nickbennett.co.uk\/index.php\/wp-json\/wp\/v2\/tags?post=1045"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}