{"id":38271,"date":"2016-08-01T17:39:29","date_gmt":"2016-08-01T12:09:29","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=38271"},"modified":"2016-08-01T17:39:29","modified_gmt":"2016-08-01T12:09:29","slug":"ssh-iam-opsworks","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/ssh-iam-opsworks\/","title":{"rendered":"Creating And Importing IAM User to Opsworks"},"content":{"rendered":"<p>Opsworks is a wonderful SaaS tool <a title=\"aws managed services\" href=\"http:\/\/www.tothenew.com\/devops-aws\">provided by AWS<\/a> which off-loads human driven tasks like managing own chef server, installing agents on each server, creating ssh user(s) even on run-time for the servers and various other benefits.<\/p>\n<p>In this blog an IAM User will be created without any CLI credentials, it will be registered with opsworks, a .pem file will be used to login and create a public key to allow the user(s) ssh into server(s).<\/p>\n<p><strong>Creating an IAM User<\/strong><\/p>\n<p>Go to IAM Service from AWS Console.<br \/>\nClick on Users(On the left side of the Page)<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-38426\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/07\/click_on_Users.png\" alt=\"IAM_Users\" width=\"1366\" height=\"768\" \/><\/p>\n<p>And then click \u201cCreate New Users\u201d<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-38427\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/07\/Create_New_User.png\" alt=\"Create_New_IAM_User\" width=\"1366\" height=\"768\" \/><\/p>\n<p>Specify the name of the IAM user to be created, uncheck \u201cGenerate an access key for each user\u201d (access key(s) are required for giving CLI access to users) and then click \u201cCreate\u201d.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-38429\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/07\/IAM_User.png\" alt=\"IAM_New_User\" width=\"1366\" height=\"768\" \/><\/p>\n<p>Now in Opsworks console, select \u201cPermissions\u201d then click Users link below the Edit button.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-38430\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/07\/Goto_Import_Users.png\" alt=\"Import_Users\" width=\"1366\" height=\"768\" \/><\/p>\n<p>After getting into Users page<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-38431\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/07\/Import_User2.png\" alt=\"Import_User\" width=\"1366\" height=\"768\" \/><\/p>\n<p>Click \u201cImport IAM users to &#8216;Selected_Region_Name&#8217; \u201d<br \/>\nAnd choose the required user.<br \/>\nOr to Import Users from different region<br \/>\nClick Import \u201cOpsWorks users from another region to &#8216;Selected_Region_Name&#8217; \u201d<\/p>\n<p>After importing, it will reflect in the Users list as:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-38434\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/07\/imported_editing.png\" alt=\"imported_User\" width=\"1366\" height=\"768\" \/><\/p>\n<p>Click on \u201cedit\u201d to change it\u2019s permissions and to provide its public key for ssh.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-38820\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/07\/edited_adding_ssh_key_to_user.png\" alt=\"ssh_key_to_user\" width=\"1366\" height=\"768\" \/><\/p>\n<p>Keep Self Management to \u201cYes\u201d, to put your own \u201cPublic SSH key\u201d.<\/p>\n<p><strong>To generate public key from private key(.pem file)<\/strong> :<\/p>\n<p>[sourcecode language=&#8221;bash&#8221;]<br \/>\nssh-keygen -y -f &lt;path_to_.pem_file&gt; &gt; test_vaibhav.pub<br \/>\ncat test_vaibhav.pub<br \/>\n[\/sourcecode]<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-38822\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/07\/edited_pub_ssh_key.png\" alt=\"public_ssh_key\" width=\"1299\" height=\"72\" \/><\/p>\n<p><strong>Granting Permissions:<\/strong><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-38439\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/07\/Granting_SSH_Permission.png\" alt=\"Granting_SSH_Permission\" width=\"1366\" height=\"768\" \/><\/p>\n<p>The SSH permissions are specific to the Stack(s).<br \/>\nSet Permission level to \u201cIAM Policies Only\u201d and Instance access to \u201cSSH\/RDP\u201d.<\/p>\n<p><strong>Permission level<\/strong> is the amount of access a user has on the stack.<br \/>\n<strong>Deny<\/strong> : It means that to user cannot perform any perform on the stack.<br \/>\n<strong>IAM Policies Only<\/strong> : The user\u2019s access on the stack is limited to the IAM policy applied on it.<br \/>\n<strong>Show<\/strong> : The user has only view access on the stack.<br \/>\n<strong>Deploy<\/strong> : The user has access to deploy app and view the stack.<br \/>\n<strong>Manage<\/strong> : The user has access to stack \u201cPermissions\u201d section, deploying apps and various management actions like modifying layers\/instances, adding or removing resources.<\/p>\n<p><strong>Instance access<\/strong><br \/>\n<strong>SSH\/RDP<\/strong> : Giving SSH\/RDP access to user corresponding to linux\/windows.<br \/>\n<strong>sudo\/admin<\/strong> : Giving sudo\/admin privileges to user respective to linux\/windows.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-38440\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/07\/Instance_on_console.png\" alt=\"Instance_on_console\" width=\"1366\" height=\"768\" \/><\/p>\n<p><strong>Now try to ssh into the server :<\/strong><br \/>\nssh -i ~\/.ssh\/[your-keyfile] test_vaibhav@INSTANCE-DNS<br \/>\nand make sure that ssh port is open for your ip in the security group in AWS Console.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-38442\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/07\/logging_in.png\" alt=\"logging_in\" width=\"1366\" height=\"768\" \/><\/p>\n<p><strong><span style=\"text-decoration: underline;\">Tip\/Trick:<\/span><\/strong> If you lose .pem file of your EC2 Instance, you can register your Instance with Opsworks, add a new user to it and later modify the keys of your previous user.<\/p>\n<p>Hope after reading this blog you&#8217;ll be comfortable in playing around with &#8220;Permissions&#8221; option in the Opsworks console !<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Opsworks is a wonderful SaaS tool provided by AWS which off-loads human driven tasks like managing own chef server, installing agents on each server, creating ssh user(s) even on run-time for the servers and various other benefits. In this blog an IAM User will be created without any CLI credentials, it will be registered with [&hellip;]<\/p>\n","protected":false},"author":913,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":4},"categories":[2348,1],"tags":[248,1935,1167,1343,3815,553],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/38271"}],"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\/913"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=38271"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/38271\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=38271"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=38271"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=38271"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}