{"id":14487,"date":"2014-07-01T14:39:49","date_gmt":"2014-07-01T09:09:49","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=14487"},"modified":"2014-12-17T09:03:33","modified_gmt":"2014-12-17T03:33:33","slug":"install-lamp-stack-using-cloud-formation","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/install-lamp-stack-using-cloud-formation\/","title":{"rendered":"Install LAMP Stack Using Cloud Formation"},"content":{"rendered":"<div style=\"color: #000000\">AWS\u00a0Cloud formation\u00a0\u00a0is a service used to create and manage a collection of other AWS services. This service is used to automate the infrastructure setup and deployment.<\/p>\n<p>In this article, we will be launching a LAMP Stack Instance using\u00a0Cloud Formation. For this we are using\u00a0Ubuntu Server 14.04 LTS (PV)\u00a0&#8211; <span>ami-9a7724c8<\/span> (64-bit)<\/div>\n<div style=\"color: #000000\">\n<span><strong><\/p>\n<h3 style=\"text-align: justify;color: #ff9900\">Steps to Launch:<\/h3>\n<p><\/strong><\/span><br \/>\n1) Create a .json file<br \/>\n2) Open AWS Console<br \/>\n3) Browse to Cloudformation, CREATE STACK and upload the .json file<\/div>\n<div style=\"color: #000000\">\n<strong><\/p>\n<h3 style=\"text-align: justify;color: #ff9900\">Create a .json file<\/h3>\n<p><\/strong>\n<\/div>\n<div>[js]<br \/>\n{<br \/>\n &quot;Resources&quot; :<br \/>\n    {<br \/>\n    &quot;WebServer&quot;:{<\/p>\n<p>      &quot;Type&quot;: &quot;AWS::EC2::Instance&quot;,<br \/>\n         &quot;Properties&quot;:{<br \/>\n         &quot;ImageId&quot; : &quot;ami-9a7724c8&quot;,<br \/>\n         &quot;KeyName&quot; : &quot;demo&quot;,<br \/>\n         &quot;InstanceType&quot;:&quot;t1.micro&quot;,<br \/>\n         &quot;SecurityGroups&quot; : [ &quot;demo&quot; ],<br \/>\n         &quot;UserData&quot; : {&quot;Fn::Base64&quot; : {&quot;Fn::Join&quot; : [&quot;&quot;, [<br \/>\n           &quot;#!\/bin\/bash\\n&quot;,<br \/>\n           &quot;# Launching Instance&quot;,<br \/>\n           &quot;apt-get -y install apache2 \\n&quot;,<br \/>\n           &quot;apt-get -y install mysql \\n&quot;,<br \/>\n           &quot;apt-get -y install mysql-server \\n&quot;,<br \/>\n           &quot;apt-get -y install php php5-mysql \\n&quot;<br \/>\n            ] ] } }<br \/>\n        }<br \/>\n    }<br \/>\n },<br \/>\n &quot;Outputs&quot;:{<br \/>\n    &quot;WebsiteURL&quot; : {<br \/>\n      &quot;Value&quot; : { &quot;Fn::Join&quot; : [&quot;&quot;, [&quot;http:\/\/&quot;, { &quot;Fn::GetAtt&quot; : [        &quot;WebServer&quot;, &quot;PublicDnsName&quot; ]}]] },<br \/>\n        &quot;Description&quot; : &quot;URL for newly created LAMP stack&quot;<br \/>\n   }<br \/>\n }<br \/>\n}<br \/>\n[\/js]\n<\/p><\/div>\n<p>[js] **Note: Keyname and Security groups must exists on your account [\/js]<\/p>\n<div><strong><span><\/p>\n<h3 style=\"text-align: justify;color: #ff9900\">Open AWS Console &gt; Browse to Cloud Formation &gt;Create Stack<\/h3>\n<p><\/span><\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/cloudformation2.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-14492\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/cloudformation2.png\" alt=\"cloudformation2\" width=\"460\" height=\"151\" \/><\/a><\/strong><\/div>\n<div><\/div>\n<div>Once you click <strong style=\"color:#ff9900\">Create Stack<\/strong> button, it will ask for the <strong>Stack Name<\/strong> and the <strong>.json<\/strong> file.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/cloudformation3.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-14493\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/cloudformation3.png\" alt=\"cloudformation3\" width=\"854\" height=\"596\" \/><\/a><\/div>\n<div><\/div>\n<div>Upload the <span><strong style=\"color:#ff9900\">.json<\/strong><\/span> file and Follow the wizard. The next wizard ask you to enter the Key Value name for the Instance:<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/cloudfomration4.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-14497\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/cloudfomration4.png\" alt=\"cloudfomration4\" width=\"1067\" height=\"398\" \/><\/a><\/p>\n<\/div>\n<div>Click\u00a0the <span style=\"color:#ff9900\">Next Button<\/span> and the launch the stack. Once you launch the stack, you will get the following screen with launching process events.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/cloudformation6.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-14498\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/cloudformation6.png\" alt=\"cloudformation6\" width=\"734\" height=\"416\" \/><\/a><\/p>\n<p>If everything goes well, you will get the the <span style=\"color:#ff9900\">CREATE_COMPLETE<\/span> message in the Status Tab. If any error occurs then a <span style=\"color:#ff9900\">ROLLBACK<\/span> event is invoked which will delete the stack.<\/p>\n<p>Since we got the <span style=\"color:#ff9900\">CREATE_COMPLETE<\/span> message with a output parameter that we have defined in our json which returns the public DNS name of the Instance.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/cloudformation7.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-14499\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/cloudformation7.png\" alt=\"cloudformation7\" width=\"1088\" height=\"432\" \/><\/a><\/div>\n<div><\/div>\n<div><span style=\"color:#ff9900\">By Clicking on the output\u00a0URL, it takes us to the apache default page: <\/span><\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/cloudformation12.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-14500\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/cloudformation12.png\" alt=\"cloudformation12\" width=\"959\" height=\"589\" \/><\/a><\/div>\n<div><\/div>\n<div>We can check the Console to see our running Instances:<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/cloudformation10.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-14501\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/cloudformation10.png\" alt=\"cloudformation10\" width=\"1098\" height=\"187\" \/><\/p>\n<p><\/a>We can see the <span style=\"color:#ff9900\">Public DNS<\/span> is same.<\/p>\n<p>To Terminate this Instance we can delete the stack from the Cloud Formation Wizard. Deleting the stack will terminate all the instances launched by that stack.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/cloudformation11.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-14502\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/cloudformation11.png\" alt=\"cloudformation11\" width=\"668\" height=\"187\" \/><\/a><\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/cloudformation13.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-14503\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/07\/cloudformation13.png\" alt=\"cloudformation13\" width=\"1090\" height=\"152\" \/><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>AWS\u00a0Cloud formation\u00a0\u00a0is a service used to create and manage a collection of other AWS services. This service is used to automate the infrastructure setup and deployment. In this article, we will be launching a LAMP Stack Instance using\u00a0Cloud Formation. For this we are using\u00a0Ubuntu Server 14.04 LTS (PV)\u00a0&#8211; ami-9a7724c8 (64-bit) Steps to Launch: 1) Create [&hellip;]<\/p>\n","protected":false},"author":100,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":8},"categories":[1174],"tags":[1464,49],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/14487"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/100"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=14487"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/14487\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=14487"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=14487"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=14487"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}