Sunday, 17 March 2019

How to run any command from IAM user account to more then one EC2 server of main account at same time By Raj Gupta

During Creation of EC2 server install the SSM agent  and attach the IAM AmazonEC2RoleforSSM policy on all the server

1. Create IAM role let say rajrole and attach the policy   AmazonEC2RoleforSSM 

2. Now create EC2 in which attach role rajrole and install SSM agent


3. Now Create IAM user account let say rajguptaaws and attach the AmazonSSMFullAccess policy by using IAM console


4. Now logging to IAM user account(rajguptaaws)


6. Now run the command from user account on all EC2 sever of main account

select run shellscript


Now select all EC2 server from main account on which you want to run the command

Now give the command which you want to run on all server let say

touch testfile -  create testfile in /tmp directory
ls - list all file in /tmp directory
yum update -y -- yum update




After all command run you will get result like below


No comments:

Post a Comment