How Amazon Pinpoint works with IAM - Amazon Pinpoint

How Amazon Pinpoint works with IAM

To use Amazon Pinpoint, users in your AWS account require permissions that allow them to view analytics data, create projects, define user segments, deploy campaigns, and more. If you integrate a mobile or web app with Amazon Pinpoint, users of your app also require access to Amazon Pinpoint. This access enables your app to register endpoints and report usage data to Amazon Pinpoint. To grant access to Amazon Pinpoint features, create AWS Identity and Access Management (IAM) policies that allow Amazon Pinpoint actions for IAM identities or Amazon Pinpoint resources.

IAM is a service that helps administrators securely control access to AWS resources. IAM policies include statements that allow or deny specific actions by specific users or for specific resources. Amazon Pinpoint provides a set of actions that you can use in IAM policies to specify granular permissions for Amazon Pinpoint users and resources. This means that you can grant the appropriate level of access to Amazon Pinpoint without creating overly permissive policies that might expose important data or compromise your resources. For example, you can grant unrestricted access to an Amazon Pinpoint administrator, and grant read-only access to individuals who need access to only a specific project.

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

Amazon Pinpoint 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. Amazon Pinpoint supports specific actions, resources, and condition keys. To learn about all the elements that you can use in a JSON policy, see IAM JSON policy elements reference in the IAM User Guide.

Actions

Administrators can use AWS 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 AWS 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.

This means that policy actions control what users can do on the Amazon Pinpoint console. They also control what users can do programmatically by using the AWS SDKs, the AWS Command Line Interface (AWS CLI), or the Amazon Pinpoint APIs directly.

Policy actions in Amazon Pinpoint use the following prefixes:

  • mobiletargeting – For actions that derive from the Amazon Pinpoint API, which is the primary API for Amazon Pinpoint.

  • sms-voice – For actions that derive from the Amazon Pinpoint SMS and Voice API, which is a supplemental API that provides advanced options for using and managing the SMS and voice channels in Amazon Pinpoint.

For example, to grant someone permission to view information about all the segments for a project, which is an action that corresponds to the GetSegments operation in the Amazon Pinpoint API, include the mobiletargeting:GetSegments action in their policy. Policy statements must include either an Action or NotAction element. Amazon Pinpoint defines its own set of actions that describe the tasks that users can perform with it.

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

"Action": [ "mobiletargeting:action1", "mobiletargeting:action2"

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

"Action": "mobiletargeting:Get*"

However, as a best practice, you should create policies that follow the principle of least privilege. In other words, you should create policies that include only the permissions that are required to perform a specific action.

For a list of Amazon Pinpoint actions that you can use in IAM policies, see Amazon Pinpoint actions for IAM policies.

Resources

Administrators can use AWS 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": "*"

For example, the mobiletargeting:GetSegments action retrieves information about all the segments that are associated with a specific Amazon Pinpoint project. You identify a project with an ARN in the following format:

arn:aws:mobiletargeting:${Region}:${Account}:apps/${projectId}

For more information about the format of ARNs, see Amazon Resource Names (ARNs) in the AWS General Reference.

In IAM policies, you can specify ARNs for the following types of Amazon Pinpoint resources:

  • Campaigns

  • Journeys

  • Message templates (referred to as templates in some contexts)

  • Projects (referred to as apps or applications in some contexts)

  • Recommender models (referred to as recommenders in some contexts)

  • Segments

For example, to create a policy statement for the project that has the project ID 810c7aab86d42fb2b56c8c966example, use the following ARN:

"Resource": "arn:aws:mobiletargeting:us-east-1:123456789012:apps/810c7aab86d42fb2b56c8c966example"

To specify all the projects that belong to a specific account, use the wildcard (*):

"Resource": "arn:aws:mobiletargeting:us-east-1:123456789012:apps/*"

Some Amazon Pinpoint actions, such as certain actions for creating resources, can't be performed on a specific resource. In those cases, you must use the wildcard (*):

"Resource": "*"

In IAM policies, you can also specify ARNs for the following types of Amazon Pinpoint SMS and Voice resources:

  • Configuration Set

  • Opt Out List

  • Phone Number

  • Pool

  • Sender Id

For example, to create a policy statement for a phone number that has the phone number ID phone-12345678901234567890123456789012 use the following ARN:

"Resource": "arn:aws:sms-voice:us-east-1:123456789012:phone-number/phone-12345678901234567890123456789012"

To specify all phone numbers that belong to a specific account, use a wildcard (*) in place of the phone number ID:

"Resource": "arn:aws:sms-voice:us-east-1:123456789012:phone-number/*"

Some Amazon Pinpoint SMS and Voice actions are not performed on a specific resource, such as those for managing account-level settings like spend limits. In those cases, you must use the wildcard (*):

"Resource": "*"

Some Amazon Pinpoint API actions involve multiple resources. For example, the TagResource action can add a tag to multiple projects. To specify multiple resources in a single statement, separate the ARNs with commas:

"Resource": [ "resource1", "resource2"

To see a list of Amazon Pinpoint resource types and their ARNs, see Resources Defined by Amazon Pinpoint in the IAM User Guide. To learn which actions you can specify with the ARN of each resource type, see Actions Defined by Amazon Pinpoint in the IAM User Guide.

Condition keys

Administrators can use AWS 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, AWS evaluates them using a logical AND operation. If you specify multiple values for a single condition key, AWS 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.

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

Amazon Pinpoint defines its own set of condition keys and also supports some global condition keys. To see a list of all AWS global condition keys, see AWS global condition context keys in the IAM User Guide. To see a list of Amazon Pinpoint condition keys, see Condition Keys for Amazon Pinpoint in the IAM User Guide. To learn which actions and resources you can use a condition key with, see Actions Defined by Amazon Pinpoint in the IAM User Guide.

Examples

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

Amazon Pinpoint resource-based permissions policies

Resource-based permission policies are JSON policy documents that specify what actions a specified principal can perform on an Amazon Pinpoint resource and under what conditions. Amazon Pinpoint supports resource-based permissions policies for campaigns, journeys, message templates (templates), recommender models (recommenders), projects (apps), and segments.

Examples

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

Authorization based on Amazon Pinpoint tags

You can associate tags with certain types of Amazon Pinpoint resources or pass tags in a request to Amazon Pinpoint. To control access based on tags, you provide tag information in the condition element of a policy using the aws:ResourceTag/${TagKey}, aws:RequestTag/${TagKey}, or aws:TagKeys condition keys.

For information about tagging Amazon Pinpoint resources, including an example IAM policy, see Tagging Amazon Pinpoint resources.

Amazon Pinpoint IAM roles

An IAM role is an entity within your AWS account that has specific permissions.

Using temporary credentials with Amazon Pinpoint

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

Amazon Pinpoint supports using temporary credentials.

Service-linked roles

Service-linked roles allow AWS services to access resources in other services to complete an action on your behalf. Service-linked roles appear in your IAM account and are owned by the service. An IAM administrator can view but not edit the permissions for service-linked roles.

Amazon Pinpoint doesn't use service-linked roles.

Service roles

This feature 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.

Amazon Pinpoint supports using service roles.