Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in AWS by (19.1k points)

In order to run AWS monitoring scripts (http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/mon-scripts-perl.html) on one of my ec2 existing instances, I need an IAM role associated with the instance.

I found a lot of documentation to launch an instance with a role... But nothing to link a role to an existing instance.

Is it possible?

If not, what can I do? Launch a new instance with a role and transfer the volumes to it?

1 Answer

0 votes
by (44.3k points)

Use this:

aws ec2 associate-iam-instance-profile --instance-id YourInstanceId --iam-instance-profile Name=YourNewRole-Instance-Profile

Where associate-iam-instance-profile can use to associate an IAM instance profile with running and stopped instance.

Official Documentation 

Related questions

0 votes
1 answer

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.1k users

Browse Categories

...