A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.aws.amazon.com/codecommit/latest/userguide/auth-and-access-control.html below:

Authentication and access control for AWS CodeCommit

Authentication and access control for AWS CodeCommit

Access to AWS CodeCommit requires credentials. Those credentials must have permissions to access AWS resources, such as CodeCommit repositories, and your IAM user, which you use to manage your Git credentials or the SSH public key that you use for making Git connections. The following sections provide details on how you can use AWS Identity and Access Management (IAM) and CodeCommit to help secure access to your resources:

Authentication

Because CodeCommit repositories are Git-based and support the basic functionality of Git, including Git credentials, we recommend that you use an IAM user when working with CodeCommit. You can access CodeCommit with other identity types, but the other identity types are subject to limitations, as described below.

Identity types:

Access control

You can have valid credentials to authenticate your requests, but unless you have permissions you cannot create or access CodeCommit resources. For example, you must have permissions to view repositories, push code, create and manage Git credentials, and so on.

The following sections describe how to manage permissions for CodeCommit. We recommend that you read the overview first.

Overview of managing access permissions to your CodeCommit resources

Every AWS resource is owned by an Amazon Web Services account. Permissions to create or access a resource are governed by permissions policies. An account administrator can attach permissions policies to IAM identities (that is, users, groups, and roles). Some services, such as AWS Lambda, also support attaching permissions policies to resources.

Note

An account administrator (or administrator user) is a user with administrator privileges. For more information, see IAM Best Practices in the IAM User Guide.

When granting permissions, you decide who gets the permissions, the resources they get permissions for, and the specific actions that you want to allow on those resources.

CodeCommit resources and operations

In CodeCommit, the primary resource is a repository. Each resource has a unique Amazon Resource Names (ARN) associated with it. In a policy, you use an Amazon Resource Name (ARN) to identify the resource that the policy applies to. For more information about ARNs, see Amazon Resource Names (ARN) and AWS Service Namespaces in the Amazon Web Services General Reference. CodeCommit does not currently support other resource types, which are referred to as subresources.

The following table describes how to specify CodeCommit resources.

Resource Type ARN Format Repository

arn:aws:codecommit:region:account-id:repository-name

All CodeCommit repositories

arn:aws:codecommit:*

All CodeCommit repositories owned by the specified account in the specified AWS Region

arn:aws:codecommit:region:account-id:*

Note

Most AWS services treat a colon (:) or a forward slash (/) in ARNs as the same character. However, CodeCommit requires an exact match in resource patterns and rules. When creating event patterns, be sure to use the correct ARN characters so that they match the ARN syntax in the resource.

For example, you can indicate a specific repository (MyDemoRepo) in your statement using its ARN as follows:

"Resource": "arn:aws:codecommit:us-west-2:111111111111:MyDemoRepo"

To specify all repositories that belong to a specific account, use the wildcard character (*) as follows:

"Resource": "arn:aws:codecommit:us-west-2:111111111111:*"

To specify all resources, or if a specific API action does not support ARNs, use the wildcard character (*) in the Resource element as follows:

"Resource": "*"

You can also use the wildcard character(*) to specify all resources that match part of a repository name. For example, the following ARN specifies any CodeCommit repository that begins with the name MyDemo and that is registered to the Amazon Web Services account 111111111111 in the us-east-2 AWS Region:

arn:aws:codecommit:us-east-2:111111111111:MyDemo*

For a list of available operations that work with the CodeCommit resources, see CodeCommit permissions reference.

Understanding resource ownership

The Amazon Web Services account owns the resources that are created in the account, regardless of who created them. Specifically, the resource owner is the Amazon Web Services account of the principal entity (that is, the root account, an IAM user, or an IAM role) that authenticates the resource creation request. The following examples illustrate how this works:

Managing access to resources

To manage access to AWS resources, you use permissions policies. A permissions policy describes who has access to what. The following section explains the options for creating permissions policies.

Note

This section discusses using IAM in the context of CodeCommit. It doesn't provide detailed information about the IAM service. For more information about IAM, see What Is IAM? in the IAM User Guide. For information about IAM policy syntax and descriptions, see IAM Policy Reference in the IAM User Guide.

Permissions policies that are attached to an IAM identity are referred to as identity-based policies (IAM policies). Permissions policies that are attached to a resource are referred to as resource-based policies. Currently, CodeCommit supports only identity-based policies (IAM policies).

Identity-based policies (IAM policies)

To manage access to AWS resources, you attach permissions policies to IAM identities. In CodeCommit, you use identity-based policies to control access to repositories. For example, you can do the following:

The following example policy allows a user to create a branch in a repository named MyDemoRepo:

JSON
{
  "Version": "2012-10-17",
  "Statement" : [
    {
      "Effect" : "Allow",
      "Action" : [
        "codecommit:CreateBranch"
      ],
      "Resource" : "arn:aws:codecommit:us-east-2:111122223333:MyDemoRepo"
    }
  ]
}

To restrict the calls and resources that users in your account have access to, create specific IAM policies, and then attach those policies to IAM users. For more information about how to create IAM roles and to explore example IAM policy statements for CodeCommit, see Customer managed identity policy examples.

Resource-based policies

Some services, such as Amazon S3, also support resource-based permissions policies. For example, you can attach a resource-based policy to an S3 bucket to manage access permissions to that bucket. CodeCommit doesn't support resource-based policies, but you can use tags to identify resources, which you can then use in IAM policies. For an example of a tag-based policy, see Identity-based policies (IAM policies).

Resource scoping in CodeCommit

In CodeCommit, you can scope identity-based policies and permissions to resources, as described in CodeCommit resources and operations. However, you cannot scope the ListRepositories permission to a resource. Instead, you must scope it to all resources (using the wildcard *). Otherwise, the action fails.

All other CodeCommit permissions can be scoped to resources.

Specifying policy elements: resources, actions, effects, and principals

You can create policies to allow or deny users access to resources, or allow or deny users to take specific actions on those resources. CodeCommit defines a set of public API operations that define how users work with the service, whether that is through the CodeCommit console, the SDKs, the AWS CLI, or by directly calling those APIs. To grant permissions for these API operations, CodeCommit defines a set of actions that you can specify in a policy.

Some API operations can require permissions for more than one action. For more information about resources and API operations, see CodeCommit resources and operations and CodeCommit permissions reference.

The following are the basic elements of a policy:

To learn more about IAM policy syntax, see IAM Policy Reference in the IAM User Guide.

For a table showing all of the CodeCommit API actions and the resources that they apply to, see CodeCommit permissions reference.

Specifying conditions in a policy

When you grant permissions, you use the access policy language for IAM to specify the conditions under which a policy should take effect. For example, you might want a policy to be applied only after a specific date. For more information about specifying conditions in a policy language, see Condition and Policy Grammar in the IAM User Guide.

To express conditions, you use predefined condition keys. There are no condition keys specific to CodeCommit. However, there are AWS-wide condition keys that you can use as appropriate. For a complete list of AWS-wide keys, see Available Keys for Conditions in the IAM User Guide.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4