TECHIES WORLD

For Techs.... Techniques.... Technologies....

AWS

How to restrict the user access on all EC2 instances with start and stop permissions only

Sometimes we need to give access to users on all EC2 instances with start and stop permissions without the terminate option.

We can use the following IAM policy to acheive this requirement.

{
   "Version":"2012-10-17",
   "Statement":[
          {
             "Effect":"Allow",
             "Action":"ec2:Describe*",
             "Resource":"*"
          },
          {
             "Effect":"Allow",
             "Action":[
                "ec2:StartInstances",
                "ec2:StopInstances",
                "ec2:RebootInstances"
             ],
             "Resource":[
                "arn:aws:ec2:REGION:ACCOUNT_ID:instance/*"
             ]
          }
       ]
}

Here REGION and ACCOUNT_ID need to be replaced with the corresponding values.

That's all…