How Amazon CodeCommit works with IAM - Amazon CodeCommit
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.

How Amazon CodeCommit works with IAM

Before you use IAM to manage access to CodeCommit, you should understand what IAM features are available to use with CodeCommit. To get a high-level view of how CodeCommit and other Amazon services work with IAM, see Amazon Services That Work with IAM in the IAM User Guide.

Condition keys

Administrators can use Amazon JSON policies to specify who has access to what. That is, which principal can perform actions on what resources, and under what conditions.

The Condition element (or Condition block) lets you specify conditions in which a statement is in effect. The Condition element is optional. You can create conditional expressions that use condition operators, such as equals or less than, to match the condition in the policy with values in the request.

If you specify multiple Condition elements in a statement, or multiple keys in a single Condition element, Amazon evaluates them using a logical AND operation. If you specify multiple values for a single condition key, Amazon evaluates the condition using a logical OR operation. All of the conditions must be met before the statement's permissions are granted.

You can also use placeholder variables when you specify conditions. For example, you can grant an IAM user permission to access a resource only if it is tagged with their IAM user name. For more information, see IAM policy elements: variables and tags in the IAM User Guide.

Amazon supports global condition keys and service-specific condition keys. To see all Amazon global condition keys, see Amazon global condition context keys in the IAM User Guide.

CodeCommit defines its own set of condition keys and also supports using some global condition keys. To see all Amazon global condition keys, see Amazon Global Condition Context Keys in the IAM User Guide.

Some CodeCommit actions support the codecommit:References condition key. For an example policy that uses this key, see Example 4: Deny or allow actions on branches.

To see a list of CodeCommit condition keys, see Condition Keys for Amazon CodeCommit in the IAM User Guide. To learn with which actions and resources you can use a condition key, see Actions Defined by Amazon CodeCommit.

Examples

To view examples of CodeCommit identity-based policies, see Amazon CodeCommit identity-based policy examples.