Tuesday, April 27, 2021

AWS - HowTo - How to attach IAM role to instance through AWS Systems Manager automatically

 


In this blog post, let us see how to attach IAM role to an instance automatically via AWS Systems Manager, Document option


Pre-requisite:

  • An active AWS account
  • Permissions to use/access EC2, Systems Manager -> Document options from the respective Management console(s)

Steps:

  • Login & Navigate to the AWS EC2 Management Console
  • Select an existing AWS EC2 instance which doesnt have a IAM Role attached

  • Then, navigate to AWS Systems Manager -> Automation option from the "Change Management" option sidebar
  • Now select "AWS-AttachIAMToInstance" feature
  • Fill in the "Instance Id" to which the "IAM Role" has to be attached along with the name of the "IAM Role"; click on "Execute" option at the bottom right corner

  • Now watch the progress of this action/task happening via Document automation

  • Instance post the task completion can be seen with the IAM role attached 



Note:

  • Same option can be done programmatically and/or from AWS Management Console as well but this post is to explain on how to achieve it through AWS Systems Manager
  • Performing tasks like this manually might be easier for couple of instances but real staging or production workloads handling can only be made easier by AWS Systems Manager automation feature

No comments:

Post a Comment