A fine-grained policy consists of the policy version (the Version field) and statement (the Statement field).
The valid values for Effect include Allow and Deny. In a custom policy that contains both Allow and Deny statements, the Deny statements take precedence.
The value can be one or more resource operations.
The value format is Service name:Resource type:Action, for example, vpc:ports:create.
Resources on which the policy takes effect.
Format: Service name:Region:Account ID:Resource type:Resource path. An asterisk (*) means all based on its position in the resource path.
Conditions determine when a policy takes effect. A condition consists of a condition key and operator. Condition keys (see the documentation of the relevant cloud service) are either global or service-level and are used in the Condition element of a policy statement. Global condition keys (starting with g:) are available for operations of all services, while service-level condition keys (starting with a service abbreviation name such as obs:) are available only for operations of the corresponding service. An operator is used together with a condition key to form a complete condition statement.
Format: Condition operator:{Condition key:[Value 1, Value 2]}
Example:
Global Condition Key |
Type |
Description |
---|---|---|
g:CurrentTime |
Time |
Time when an authentication request is received. The time is expressed in the format defined by ISO 8601, for example, 2012-11-11T23:59:59Z. |
g:DomainName |
Character string |
Domain name |
g:MFAPresent |
Boolean |
Indicates whether to obtain a token through MFA authentication. |
g:MFAAge |
Number |
Validity period of a token obtained through MFA authentication. This condition must be used together with g:MFAPresent. |
g:ProjectName |
Character string |
Project name |
g:ServiceName |
Character string |
Service name |
g:UserId |
Character string |
User ID |
g:UserName |
Character string |
Username |
{ "Version": "1.1", "Statement": [ { "Effect": "Allow", "Action": [ "ecs:servers:list", "ecs:servers:get", "ecs:serverVolumes:use", "ecs:diskConfigs:use", "ecs:securityGroups:use", "ecs:serverKeypairs:get", "vpc:securityGroups:list", "vpc:securityGroups:get", "vpc:securityGroupRules:get", "vpc:networks:get", "vpc:subnets:get", "vpc:ports:get", "vpc:routers:get" ] } ] }
{ "Version": "1.1", "Statement": [ { "Effect": "Allow", "Action": [ "ecs:servers:lock", "evs:volumes:create" ] } ] }
{ "Version": "1.1", "Statement": [ { "Action": [ "ims:*:*", "ecs:*:list", "ecs:*:get", "evs:*:get" ], "Effect": "Allow" } ] }
IAM authenticates users according to the permissions granted to the users. The following diagram shows the authentication process.
The actions in each policy bear the OR relationship.