{"id":41826,"date":"2016-10-26T14:42:08","date_gmt":"2016-10-26T09:12:08","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=41826"},"modified":"2016-12-19T15:04:04","modified_gmt":"2016-12-19T09:34:04","slug":"setting-up-spinnaker-on-aws","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/setting-up-spinnaker-on-aws\/","title":{"rendered":"Setting up Spinnaker on AWS"},"content":{"rendered":"<p>In my <a href=\"http:\/\/www.tothenew.com\/blog\/introduction-to-spinnaker-global-continuous-delivery\/\">previous blog<\/a>, I had given an overview of Spinnaker and its capabilities. And in this blog,\u00a0\u00a0we will see how spinnaker can be set up for continuous delivery.<\/p>\n<p>We will set up Spinnaker in an <a title=\"AWS managed services\" href=\"http:\/\/www.tothenew.com\/devops-aws\">AWS environment<\/a>, though Spinnaker can be set up on any platform\u00a0(Google Cloud, Azure, Cloud Foundry etc.) and it can be later integrated with\u00a0other providers.<\/p>\n<p>The setup process can be divided broadly into 2 parts:<\/p>\n<ol>\n<li>Setting up Cloud Provider (AWS)<\/li>\n<li>Setting up Spinnaker Instance<\/li>\n<\/ol>\n<h2>1. Setting up AWS:<\/h2>\n<p>Note: The naming convention used in the below steps are for the default configuration. You can choose to use your own names, but in that case, you might need to perform a lot of customization in Spinnaker.<\/p>\n<ol>\n<li>Create a VPC in your AWS account. We will name it &#8220;defaultvpc&#8221;.<br \/>\nCreate a subnet in your VPC created above. We will name it &#8220;defaultvpc.internal.us-east-1&#8221;. You can name it according to the region you have created your VPC in.<br \/>\nCreate an internet gateway and attach to above subnet.<br \/>\nAdd a default route for your subnet with this internet gateway.<br \/>\nThe instances brought up by spinnaker will be in this VPC\/Subnet.<\/li>\n<li>Create an EC2 IAM Role and name it &#8220;BaseIAMRole&#8221;. The instances created by Spinnaker will have this Role attached to them. You can skip this step if you do not want to assign any Role to the instances brought up by Spinnaker.<\/li>\n<li>Create AWS Keypair to access the spinnaker instance. You can create the key pair at the time of bringing up instance as well. You can also skip this step if you already have a keypair.<\/li>\n<\/ol>\n<p>Now that AWS setup is complete, Let&#8217;s bring up the Spinnaker instance.<\/p>\n<h2>2. Setting up Spinnaker Instance:<\/h2>\n<p>1. The Spinnaker instance will bring up and down other instances in your AWS account. So we need to grant it access to perform the necessary tasks. Create a new EC Role for the Spinnaker instance, and let&#8217;s call it &#8220;spinnakerRole&#8221;. We need to attach the policy &#8220;PowerUserAccess&#8221;.<br \/>\nCreate a new Inline policy through\u00a0policy generator to provide custom &#8220;PassRole&#8221; role from IAM. For creating this policy, select &#8220;AWS Identity and Access Management&#8221; from the AWS Service pulldown and select &#8220;PassRole&#8221; for Actions.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-large wp-image-41827\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/10\/001.passrole-1024x413.png\" alt=\"001.passrole\" width=\"625\" height=\"252\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2016\/10\/001.passrole-1024x413.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2016\/10\/001.passrole-300x121.png 300w, \/blog\/wp-ttn-blog\/uploads\/2016\/10\/001.passrole-624x251.png 624w, \/blog\/wp-ttn-blog\/uploads\/2016\/10\/001.passrole.png 1353w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/>Type * in Amazon Resource Name (ARN) box and apply the changes.<\/p>\n<p><span style=\"font-size: 1rem;\">Attach this policy to the Role you created above.<\/span><\/p>\n<p>2. Launch an m4.xlarge instance from EC2 console. Spinnaker has already built AMIs for you to set up Spinnaker. These AMIs are different for different regions. You can choose your AMI according to your region choice from <a href=\"http:\/\/www.spinnaker.io\/docs\/amazon-ami-ids\">this link<\/a>. You can auto-assign public IP while launching, although it will be good if you attach elastic IP for your spinnaker instance.<\/p>\n<p>Add storage and create a security group. Don&#8217;t forget to enable SSH port from your IP address.<br \/>\nAttach the key pair created above to this instance.<\/p>\n<p>3. Once your instance is up login into the instance and set a hostname for it. Make required changes in \/etc\/hostname and \/etc\/hosts files.<\/p>\n<p>4. We will create an SSH tunnel from your machine to Spinnaker instance. Spinnaker UI will be accessed from this tunnel only. In order to create the tunnel, let us set up the SSH configuration on our machine (workstation). In ~\/.ssh\/config file of your machine, create the following entry:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-41852\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/10\/002.config_SSH1.png\" alt=\"002.config_SSH\" width=\"539\" height=\"271\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2016\/10\/002.config_SSH1.png 539w, \/blog\/wp-ttn-blog\/uploads\/2016\/10\/002.config_SSH1-300x150.png 300w\" sizes=\"(max-width: 539px) 100vw, 539px\" \/><br \/>\nMake sure to change the hostname and identity file.<\/p>\n<p>5. We will now create a script to easily start and stop the tunnel. Create a file named &#8220;spinnaker-tunnel.sh&#8221; with content as given below:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-41854\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/10\/003.tunnel_script1.png\" alt=\"003.tunnel_script\" width=\"460\" height=\"379\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2016\/10\/003.tunnel_script1.png 460w, \/blog\/wp-ttn-blog\/uploads\/2016\/10\/003.tunnel_script1-300x247.png 300w\" sizes=\"(max-width: 460px) 100vw, 460px\" \/><br \/>\nProvide execute permissions to it.<\/p>\n<p>6. To start and stop the tunnel, you can execute following commands:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-41856\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/10\/004.tunnel_start_stop1.png\" alt=\"004.tunnel_start_stop\" width=\"341\" height=\"124\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2016\/10\/004.tunnel_start_stop1.png 341w, \/blog\/wp-ttn-blog\/uploads\/2016\/10\/004.tunnel_start_stop1-300x109.png 300w\" sizes=\"(max-width: 341px) 100vw, 341px\" \/><\/p>\n<p>That is all you need to do to set up Spinnaker on AWS. The Spinnaker management console can be accessed from the following URL:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-41831\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/10\/005.spinnaker_UI.png\" alt=\"005.spinnaker_UI\" width=\"726\" height=\"558\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2016\/10\/005.spinnaker_UI.png 726w, \/blog\/wp-ttn-blog\/uploads\/2016\/10\/005.spinnaker_UI-300x230.png 300w, \/blog\/wp-ttn-blog\/uploads\/2016\/10\/005.spinnaker_UI-624x479.png 624w\" sizes=\"(max-width: 726px) 100vw, 726px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-41832\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/10\/006.spinnaker_UI.png\" alt=\"006.spinnaker_UI\" width=\"914\" height=\"638\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2016\/10\/006.spinnaker_UI.png 914w, \/blog\/wp-ttn-blog\/uploads\/2016\/10\/006.spinnaker_UI-300x209.png 300w, \/blog\/wp-ttn-blog\/uploads\/2016\/10\/006.spinnaker_UI-624x435.png 624w\" sizes=\"(max-width: 914px) 100vw, 914px\" \/><\/p>\n<p>You need to follow the steps mentioned above to create\u00a0a tunnel so\u00a0that spinnaker is available via SSH tunnel only. This is because we have not used any SSL certificates, so this secures the whole communication. Also, you don&#8217;t need to open additional ports in the security group. Only SSH port needs to be allowed. However, if you want, you can choose to access Spinnaker directly over HTTP, and for that, you need to open required ports in your security group. If you choose to do so, it&#8217;s better to use (self-signed) certificates as well.<\/p>\n<p>In the next blog, we will see how we can bring up the clusters in Spinnaker, and how pipelines are set up in Spinnaker.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my previous blog, I had given an overview of Spinnaker and its capabilities. And in this blog,\u00a0\u00a0we will see how spinnaker can be set up for continuous delivery. We will set up Spinnaker in an AWS environment, though Spinnaker can be set up on any platform\u00a0(Google Cloud, Azure, Cloud Foundry etc.) and it can [&hellip;]<\/p>\n","protected":false},"author":931,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":7},"categories":[1993,1174,2348,1],"tags":[248,1550,2366,3457,3233,1892,4078,4077],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/41826"}],"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\/931"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=41826"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/41826\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=41826"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=41826"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=41826"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}