An IAM policy that allows an IAM user to start or stop EC2 instances, but only if the instance tag Owner has the value of that user's user name. This policy also provides the permissions necessary to complete this action on the console.

 
Tags
Console Access
API and CLI Access
Tags
Missing Parameters
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "ec2:DescribeInstances"
            ],
            "Resource": [
                "*"
            ],
            "Effect": "Allow",
            "Condition": []
        },
        {
            "Action": [
                "ec2:StartInstances",
                "ec2:StopInstances"
            ],
            "Resource": [
                "arn:aws:ec2:::instance/*"
            ],
            "Effect": "Allow",
            "Condition": [
                {
                    "StringEquals": {
                        "ec2:ResourceTag/Owner": "${aws:username}"
                    }
                }
            ]
        }
    ]
}
Customize Policy
* Required field