IAM roles for sending events to targets in Amazon EventBridge
To relay events to targets, EventBridge needs an IAM role.
To create an IAM role for sending events to EventBridge
Open the IAM console at https://eusc-de-east-1.console.amazonaws-eusc.eu/iam/
. -
To create an IAM role, follow the steps in Creating a Role to Delegate Permissions to an AWS Service in the IAM User Guide. As you follow the steps, do the following:
-
In Role Name, use a name that is unique within your account.
-
In Select Role Type, choose AWS Service Roles, and then choose Amazon EventBridge. This grants EventBridge permissions to assume the role.
-
In Attach Policy, choose AmazonEventBridgeFullAccess.
-
You can also create your own custom IAM policies for EventBridge actions and resources. Attach these policies to the IAM users or groups that need the permissions. For more information about IAM policies, see Overview of IAM Policies in the IAM User Guide. To learn how to create and manage custom policies, see Managing IAM Policies in the IAM User Guide.
Permissions required for EventBridge to access targets using IAM roles
EventBridge targets typically require IAM roles that grant EventBridge permission to invoke the target. The following sections give examples for several AWS services and targets. For other targets, use the EventBridge console to create a rule. The console creates a new role for you, with a policy that has well-scoped permissions already configured.
Set the correct permissions for each target type. Without the appropriate IAM role or resource-based policy, EventBridge cannot invoke the target, and event delivery fails. Each target type uses a different permission model. Review the requirements for your target before you create a rule. Several target types rely on resource-based policies. To create these policies, see Using resource-based policies for Amazon EventBridge. To create the IAM roles that EventBridge assumes, see Creating a Role to Delegate Permissions to an AWS Service in the IAM User Guide.
Permission requirements vary by target type:
| Target type | Permission requirement |
|---|---|
Amazon SQS, Amazon SNS, and Lambda |
Supports both IAM execution roles and resource-based policies. |
CloudWatch Logs |
Does not use roles; instead, permissions must be granted with a resource-based policy. |
EventBridge event bus |
EventBridge event bus targets must have an IAM role that grants
|
API Gateway |
Can use either resource-based policies or IAM roles. |
API destinations
If the target is an API destination, the role you specify must include a policy with the following statement:
Effect:
AllowAction:
events:InvokeApiDestinationResource:
arn:aws:events:*:*:api-destination/*
Kinesis streams
If the target is a Kinesis stream, the role used to send event data to that target must include a policy with the following statement:
Effect:
AllowAction:
kinesis:PutRecordResource:
*
Systems Manager run commands
If the target is Systems Manager run command, and you specify one or more InstanceIds
values for the command, the role you specify must include a policy with the following statement:
Effect:
AllowAction:
ssm:SendCommandResources:
arn:aws:ec2:region:accountId:instance/instanceId1arn:aws:ec2:region:accountId:instance/instanceId2arn:aws:ssm:region:*:document/documentName
If the target is Systems Manager run command and you specify one or more tags to target instances, the role must include the following statement:
Effect:
AllowAction:
ssm:SendCommandResources:
arn:aws:ec2:region:accountId:instance/*arn:aws:ssm:region:accountId:managed-instance/*
Condition:
"StringEquals": { "aws:ResourceTag/tagKey": ["tagValues"] }
The aws:ResourceTag condition key works for both EC2 instances and hybrid
managed instances (on-premises nodes registered with Systems Manager). The
ssm:resourceTag/ condition key is also
supported for the tagKeySendCommand action.
The role must also include the following statement to grant access to the Systems Manager document:
Effect:
AllowAction:
ssm:SendCommandResource:
arn:aws:ssm:region:*:document/documentName
Step Functions state machines
If the target is an AWS Step Functions state machine, the role you specify must include a policy with the following:
Effect:
AllowAction:
states:StartExecutionResource:
arn:aws:states:*:*:stateMachine:*
Amazon ECS tasks
If the target is an Amazon ECS task, the role you specify must include the following policy.
The following policy allows built-in targets in EventBridge to perform Amazon EC2 actions on your behalf. You need to use the AWS Management Console to create rules with built-in targets.
The following policy allows EventBridge to relay events to the Kinesis streams in your account.
Customer-managed policy example: Using tagging to control access to rules
You can grant users access to specific EventBridge rules while preventing them from accessing other rules. To do so, you tag both sets of rules and then use IAM policies that refer to those tags. For more information about tagging EventBridge resources, see Tagging resources in Amazon EventBridge.
You can attach an IAM policy to a user to allow access to only the rules with a
particular tag. You choose which rules to grant access to by tagging them with that
particular tag. For example, the following policy grants a user access to rules with the
value of Prod for the tag key Stack.
The following example shows a user policy that grants permissions for EventBridge actions. This policy works when you use the EventBridge API, AWS SDKs, or the AWS CLI.
{ "Statement": [ { "Effect": "Allow", "Action": "events:*", "Resource": "*", "Condition": { "StringEquals": { "aws:ResourceTag/Stack": "Prod" } } } ] }
For more information about using IAM policy statements, see Controlling Access Using Policies in the IAM User Guide.