0

Is there any way to attach IAM role to an existing instance via AWS Tools for Windows PowerShell? I've seen in https://aws.amazon.com/blogs/security/new-attach-an-aws-iam-role-to-an-existing-amazon-ec2-instance-by-using-the-aws-cli/ that aws-cli is able do it, but I'd prefer powershell if I had a choice.

0

You can do it in powershell, here is the command documentation: https://docs.aws.amazon.com/powershell/latest/reference/items/Set-EC2IamInstanceProfileAssociation.html

  • Yes, I found this command too, but it is not clear for me what parameters does it use. Set-EC2IamInstanceProfileAssociation-IamInstanceProfile_Arn <String>-AssociationId <String>-IamInstanceProfile_Name <String>-Force <SwitchParameter> Are IamInstanceProfile and IamInstanceProfile_Name related to the same resource? Also there is no AssociationId in a first place, until you link your instance to a role first time. I don't see something like "InstanceId" in parameters and I don't know how to make reference for target instance in this case – Shanjohn Mar 19 '18 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.