Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
Amazon EC2: Allows starting or stopping
EC2 instances a user has tagged, programmatically and in the console
This example shows how you might create an identity-based 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 defines permissions for programmatic and console access.
- JSON
-
-
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:StartInstances",
"ec2:StopInstances"
],
"Resource": "arn:aws-cn:ec2:*
:*
:instance/*",
"Condition": {
"StringEquals": {
"aws:ResourceTag/Owner": "${aws:username}"
}
}
},
{
"Effect": "Allow",
"Action": "ec2:DescribeInstances",
"Resource": "*"
}
]
}