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

How Amazon CodePipeline works with IAM

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

CodePipeline identity-based policies

With IAM identity-based policies, you can specify allowed or denied actions and resources as well as the conditions under which actions are allowed or denied. CodePipeline supports specific actions, resources, and condition keys. To learn about all of the elements that you use in a JSON policy, see IAM JSON Policy Elements Reference in the IAM User Guide.


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 Action element of a JSON policy describes the actions that you can use to allow or deny access in a policy. Policy actions usually have the same name as the associated Amazon API operation. There are some exceptions, such as permission-only actions that don't have a matching API operation. There are also some operations that require multiple actions in a policy. These additional actions are called dependent actions.

Include actions in a policy to grant permissions to perform the associated operation.

Policy actions in CodePipeline use the following prefix before the action: codepipeline:.

For example, to grant someone permission to view the existing pipelines in the account, you include the codepipeline:GetPipeline action in their policy. Policy statements must include either an Action or NotAction element. CodePipeline defines its own set of actions that describe tasks that you can perform with this service.

To specify multiple actions in a single statement, separate them with commas as follows:

"Action": [ "codepipeline:action1", "codepipeline:action2"

You can specify multiple actions using wildcards (*). For example, to specify all actions that begin with the word Get, include the following action:

"Action": "codepipeline:Get*"

For a list of CodePipeline actions, see Actions Defined by Amazon CodePipeline in the IAM User Guide.


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 Resource JSON policy element specifies the object or objects to which the action applies. Statements must include either a Resource or a NotResource element. As a best practice, specify a resource using its Amazon Resource Name (ARN). You can do this for actions that support a specific resource type, known as resource-level permissions.

For actions that don't support resource-level permissions, such as listing operations, use a wildcard (*) to indicate that the statement applies to all resources.

"Resource": "*"

CodePipeline resources and operations

In CodePipeline, the primary resource is a pipeline. In a policy, you use an Amazon Resource Name (ARN) to identify the resource that the policy applies to. CodePipeline supports other resources that can be used with the primary resource, such as stages, actions, and custom actions. These are referred to as subresources. These resources and subresources have unique Amazon Resource Names (ARNs) associated with them. For more information about ARNs, see Amazon Resource Names (ARN) and Amazon Web Service namespaces in the Amazon Web Services General Reference. To get the pipeline ARN associated with your pipeline, you can find the pipeline ARN under Settings in the console. For more information, see View the pipeline ARN and service role ARN (console).

Resource Type ARN Format







Custom action arn:aws:codepipeline:region:account:actiontype:owner/category/provider/version

All CodePipeline resources


All CodePipeline resources owned by the specified account in the specified Region



Most services in Amazon treat a colon (:) or a forward slash (/) as the same character in ARNs. However, CodePipeline uses an exact match in event patterns and rules. Be sure to use the correct ARN characters when creating event patterns so that they match the ARN syntax in the pipeline you want to match.

In CodePipeline, there are API calls that support resource-level permissions. Resource-level permissions indicate whether an API call can specify a resource ARN, or whether the API call can only specify all resources using the wildcard. See CodePipeline permissions reference for a detailed description of resource-level permissions and a listing of the CodePipeline API calls that support resource-level permissions.

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

"Resource": "arn:aws:codepipeline:us-east-2:111222333444:myPipeline"

You can also specify all pipelines that belong to a specific account by using the (*) wildcard character as follows:

"Resource": "arn:aws:codepipeline:us-east-2:111222333444:*"

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": "*"

When you create IAM policies, follow the standard security advice of granting least privilege—that is, granting only the permissions required to perform a task. If an API call supports ARNs, then it supports resource-level permissions, and you do not need to use the (*) wildcard character.

Some CodePipeline API calls accept multiple resources (for example, GetPipeline). To specify multiple resources in a single statement, separate their ARNs with commas, as follows:

"Resource": ["arn1", "arn2"]

CodePipeline provides a set of operations to work with the CodePipeline resources. For a list of available operations, see CodePipeline permissions reference.

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.

CodePipeline 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.

All Amazon EC2 actions support the aws:RequestedRegion and ec2:Region condition keys. For more information, see Example: Restricting Access to a Specific Region.

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


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

CodePipeline resource-based policies

CodePipeline does not support resource-based policies. However, a resource-based policy example for the S3 service related to CodePipeline is provided.


To view examples of CodePipeline resource-based policies, see Amazon CodePipeline resource-based policy examples,

Authorization based on CodePipeline tags

You can attach tags to CodePipeline resources or pass tags in a request to CodePipeline. To control access based on tags, you provide tag information in the condition element of a policy using the codepipeline:ResourceTag/key-name, aws:RequestTag/key-name, or aws:TagKeys condition keys. For more information about tagging CodePipeline resources, see Tagging resources.

To view an example identity-based policy for limiting access to a resource based on the tags on that resource, see Using tags to control access to CodePipeline resources.

CodePipeline IAM roles

An IAM role is an entity in your Amazon account that has specific permissions.

Using temporary credentials with CodePipeline

You can use temporary credentials to sign in with federation, assume an IAM role, or to assume a cross-account role. You obtain temporary security credentials by calling Amazon STS API operations such as AssumeRole or GetFederationToken.

CodePipeline supports the use of temporary credentials.

Service roles

CodePipeline allows a service to assume a service role on your behalf. This role allows the service to access resources in other services to complete an action on your behalf. Service roles appear in your IAM account and are owned by the account. This means that an IAM administrator can change the permissions for this role. However, doing so might break the functionality of the service.

CodePipeline supports service roles.