1. Packages
  2. AWS
  3. API Docs
  4. cloudwatch
  5. EventPermission
AWS v6.74.0 published on Wednesday, Mar 26, 2025 by Pulumi

aws.cloudwatch.EventPermission

Explore with Pulumi AI

Provides a resource to create an EventBridge permission to support cross-account events in the current account default event bus.

Note: EventBridge was formerly known as CloudWatch Events. The functionality is identical.

Note: The EventBridge bus policy resource (aws.cloudwatch.EventBusPolicy) is incompatible with the EventBridge permission resource (aws.cloudwatch.EventPermission) and will overwrite permissions.

Example Usage

Account Access

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const devAccountAccess = new aws.cloudwatch.EventPermission("DevAccountAccess", {
    principal: "123456789012",
    statementId: "DevAccountAccess",
});
Copy
import pulumi
import pulumi_aws as aws

dev_account_access = aws.cloudwatch.EventPermission("DevAccountAccess",
    principal="123456789012",
    statement_id="DevAccountAccess")
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := cloudwatch.NewEventPermission(ctx, "DevAccountAccess", &cloudwatch.EventPermissionArgs{
			Principal:   pulumi.String("123456789012"),
			StatementId: pulumi.String("DevAccountAccess"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var devAccountAccess = new Aws.CloudWatch.EventPermission("DevAccountAccess", new()
    {
        Principal = "123456789012",
        StatementId = "DevAccountAccess",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudwatch.EventPermission;
import com.pulumi.aws.cloudwatch.EventPermissionArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var devAccountAccess = new EventPermission("devAccountAccess", EventPermissionArgs.builder()
            .principal("123456789012")
            .statementId("DevAccountAccess")
            .build());

    }
}
Copy
resources:
  devAccountAccess:
    type: aws:cloudwatch:EventPermission
    name: DevAccountAccess
    properties:
      principal: '123456789012'
      statementId: DevAccountAccess
Copy

Organization Access

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const organizationAccess = new aws.cloudwatch.EventPermission("OrganizationAccess", {
    principal: "*",
    statementId: "OrganizationAccess",
    condition: {
        key: "aws:PrincipalOrgID",
        type: "StringEquals",
        value: example.id,
    },
});
Copy
import pulumi
import pulumi_aws as aws

organization_access = aws.cloudwatch.EventPermission("OrganizationAccess",
    principal="*",
    statement_id="OrganizationAccess",
    condition={
        "key": "aws:PrincipalOrgID",
        "type": "StringEquals",
        "value": example["id"],
    })
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := cloudwatch.NewEventPermission(ctx, "OrganizationAccess", &cloudwatch.EventPermissionArgs{
			Principal:   pulumi.String("*"),
			StatementId: pulumi.String("OrganizationAccess"),
			Condition: &cloudwatch.EventPermissionConditionArgs{
				Key:   pulumi.String("aws:PrincipalOrgID"),
				Type:  pulumi.String("StringEquals"),
				Value: pulumi.Any(example.Id),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var organizationAccess = new Aws.CloudWatch.EventPermission("OrganizationAccess", new()
    {
        Principal = "*",
        StatementId = "OrganizationAccess",
        Condition = new Aws.CloudWatch.Inputs.EventPermissionConditionArgs
        {
            Key = "aws:PrincipalOrgID",
            Type = "StringEquals",
            Value = example.Id,
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudwatch.EventPermission;
import com.pulumi.aws.cloudwatch.EventPermissionArgs;
import com.pulumi.aws.cloudwatch.inputs.EventPermissionConditionArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var organizationAccess = new EventPermission("organizationAccess", EventPermissionArgs.builder()
            .principal("*")
            .statementId("OrganizationAccess")
            .condition(EventPermissionConditionArgs.builder()
                .key("aws:PrincipalOrgID")
                .type("StringEquals")
                .value(example.id())
                .build())
            .build());

    }
}
Copy
resources:
  organizationAccess:
    type: aws:cloudwatch:EventPermission
    name: OrganizationAccess
    properties:
      principal: '*'
      statementId: OrganizationAccess
      condition:
        key: aws:PrincipalOrgID
        type: StringEquals
        value: ${example.id}
Copy

Create EventPermission Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new EventPermission(name: string, args: EventPermissionArgs, opts?: CustomResourceOptions);
@overload
def EventPermission(resource_name: str,
                    args: EventPermissionArgs,
                    opts: Optional[ResourceOptions] = None)

@overload
def EventPermission(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    principal: Optional[str] = None,
                    statement_id: Optional[str] = None,
                    action: Optional[str] = None,
                    condition: Optional[EventPermissionConditionArgs] = None,
                    event_bus_name: Optional[str] = None)
func NewEventPermission(ctx *Context, name string, args EventPermissionArgs, opts ...ResourceOption) (*EventPermission, error)
public EventPermission(string name, EventPermissionArgs args, CustomResourceOptions? opts = null)
public EventPermission(String name, EventPermissionArgs args)
public EventPermission(String name, EventPermissionArgs args, CustomResourceOptions options)
type: aws:cloudwatch:EventPermission
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. EventPermissionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. EventPermissionArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. EventPermissionArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. EventPermissionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. EventPermissionArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var eventPermissionResource = new Aws.CloudWatch.EventPermission("eventPermissionResource", new()
{
    Principal = "string",
    StatementId = "string",
    Action = "string",
    Condition = new Aws.CloudWatch.Inputs.EventPermissionConditionArgs
    {
        Key = "string",
        Type = "string",
        Value = "string",
    },
    EventBusName = "string",
});
Copy
example, err := cloudwatch.NewEventPermission(ctx, "eventPermissionResource", &cloudwatch.EventPermissionArgs{
	Principal:   pulumi.String("string"),
	StatementId: pulumi.String("string"),
	Action:      pulumi.String("string"),
	Condition: &cloudwatch.EventPermissionConditionArgs{
		Key:   pulumi.String("string"),
		Type:  pulumi.String("string"),
		Value: pulumi.String("string"),
	},
	EventBusName: pulumi.String("string"),
})
Copy
var eventPermissionResource = new EventPermission("eventPermissionResource", EventPermissionArgs.builder()
    .principal("string")
    .statementId("string")
    .action("string")
    .condition(EventPermissionConditionArgs.builder()
        .key("string")
        .type("string")
        .value("string")
        .build())
    .eventBusName("string")
    .build());
Copy
event_permission_resource = aws.cloudwatch.EventPermission("eventPermissionResource",
    principal="string",
    statement_id="string",
    action="string",
    condition={
        "key": "string",
        "type": "string",
        "value": "string",
    },
    event_bus_name="string")
Copy
const eventPermissionResource = new aws.cloudwatch.EventPermission("eventPermissionResource", {
    principal: "string",
    statementId: "string",
    action: "string",
    condition: {
        key: "string",
        type: "string",
        value: "string",
    },
    eventBusName: "string",
});
Copy
type: aws:cloudwatch:EventPermission
properties:
    action: string
    condition:
        key: string
        type: string
        value: string
    eventBusName: string
    principal: string
    statementId: string
Copy

EventPermission Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The EventPermission resource accepts the following input properties:

Principal This property is required. string
The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
StatementId
This property is required.
Changes to this property will trigger replacement.
string
An identifier string for the external account that you are granting permissions to.
Action string
The action that you are enabling the other account to perform. Defaults to events:PutEvents.
Condition EventPermissionCondition
Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
EventBusName Changes to this property will trigger replacement. string
The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.
Principal This property is required. string
The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
StatementId
This property is required.
Changes to this property will trigger replacement.
string
An identifier string for the external account that you are granting permissions to.
Action string
The action that you are enabling the other account to perform. Defaults to events:PutEvents.
Condition EventPermissionConditionArgs
Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
EventBusName Changes to this property will trigger replacement. string
The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.
principal This property is required. String
The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
statementId
This property is required.
Changes to this property will trigger replacement.
String
An identifier string for the external account that you are granting permissions to.
action String
The action that you are enabling the other account to perform. Defaults to events:PutEvents.
condition EventPermissionCondition
Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
eventBusName Changes to this property will trigger replacement. String
The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.
principal This property is required. string
The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
statementId
This property is required.
Changes to this property will trigger replacement.
string
An identifier string for the external account that you are granting permissions to.
action string
The action that you are enabling the other account to perform. Defaults to events:PutEvents.
condition EventPermissionCondition
Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
eventBusName Changes to this property will trigger replacement. string
The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.
principal This property is required. str
The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
statement_id
This property is required.
Changes to this property will trigger replacement.
str
An identifier string for the external account that you are granting permissions to.
action str
The action that you are enabling the other account to perform. Defaults to events:PutEvents.
condition EventPermissionConditionArgs
Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
event_bus_name Changes to this property will trigger replacement. str
The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.
principal This property is required. String
The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
statementId
This property is required.
Changes to this property will trigger replacement.
String
An identifier string for the external account that you are granting permissions to.
action String
The action that you are enabling the other account to perform. Defaults to events:PutEvents.
condition Property Map
Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
eventBusName Changes to this property will trigger replacement. String
The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.

Outputs

All input properties are implicitly available as output properties. Additionally, the EventPermission resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing EventPermission Resource

Get an existing EventPermission resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: EventPermissionState, opts?: CustomResourceOptions): EventPermission
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        action: Optional[str] = None,
        condition: Optional[EventPermissionConditionArgs] = None,
        event_bus_name: Optional[str] = None,
        principal: Optional[str] = None,
        statement_id: Optional[str] = None) -> EventPermission
func GetEventPermission(ctx *Context, name string, id IDInput, state *EventPermissionState, opts ...ResourceOption) (*EventPermission, error)
public static EventPermission Get(string name, Input<string> id, EventPermissionState? state, CustomResourceOptions? opts = null)
public static EventPermission get(String name, Output<String> id, EventPermissionState state, CustomResourceOptions options)
resources:  _:    type: aws:cloudwatch:EventPermission    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Action string
The action that you are enabling the other account to perform. Defaults to events:PutEvents.
Condition EventPermissionCondition
Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
EventBusName Changes to this property will trigger replacement. string
The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.
Principal string
The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
StatementId Changes to this property will trigger replacement. string
An identifier string for the external account that you are granting permissions to.
Action string
The action that you are enabling the other account to perform. Defaults to events:PutEvents.
Condition EventPermissionConditionArgs
Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
EventBusName Changes to this property will trigger replacement. string
The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.
Principal string
The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
StatementId Changes to this property will trigger replacement. string
An identifier string for the external account that you are granting permissions to.
action String
The action that you are enabling the other account to perform. Defaults to events:PutEvents.
condition EventPermissionCondition
Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
eventBusName Changes to this property will trigger replacement. String
The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.
principal String
The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
statementId Changes to this property will trigger replacement. String
An identifier string for the external account that you are granting permissions to.
action string
The action that you are enabling the other account to perform. Defaults to events:PutEvents.
condition EventPermissionCondition
Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
eventBusName Changes to this property will trigger replacement. string
The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.
principal string
The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
statementId Changes to this property will trigger replacement. string
An identifier string for the external account that you are granting permissions to.
action str
The action that you are enabling the other account to perform. Defaults to events:PutEvents.
condition EventPermissionConditionArgs
Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
event_bus_name Changes to this property will trigger replacement. str
The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.
principal str
The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
statement_id Changes to this property will trigger replacement. str
An identifier string for the external account that you are granting permissions to.
action String
The action that you are enabling the other account to perform. Defaults to events:PutEvents.
condition Property Map
Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
eventBusName Changes to this property will trigger replacement. String
The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.
principal String
The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
statementId Changes to this property will trigger replacement. String
An identifier string for the external account that you are granting permissions to.

Supporting Types

EventPermissionCondition
, EventPermissionConditionArgs

Key This property is required. string
Key for the condition. Valid values: aws:PrincipalOrgID.
Type This property is required. string
Type of condition. Value values: StringEquals.
Value This property is required. string
Value for the key.
Key This property is required. string
Key for the condition. Valid values: aws:PrincipalOrgID.
Type This property is required. string
Type of condition. Value values: StringEquals.
Value This property is required. string
Value for the key.
key This property is required. String
Key for the condition. Valid values: aws:PrincipalOrgID.
type This property is required. String
Type of condition. Value values: StringEquals.
value This property is required. String
Value for the key.
key This property is required. string
Key for the condition. Valid values: aws:PrincipalOrgID.
type This property is required. string
Type of condition. Value values: StringEquals.
value This property is required. string
Value for the key.
key This property is required. str
Key for the condition. Valid values: aws:PrincipalOrgID.
type This property is required. str
Type of condition. Value values: StringEquals.
value This property is required. str
Value for the key.
key This property is required. String
Key for the condition. Valid values: aws:PrincipalOrgID.
type This property is required. String
Type of condition. Value values: StringEquals.
value This property is required. String
Value for the key.

Import

Using pulumi import, import EventBridge permissions using the event_bus_name/statement_id (if you omit event_bus_name, the default event bus will be used). For example:

$ pulumi import aws:cloudwatch/eventPermission:EventPermission DevAccountAccess example-event-bus/DevAccountAccess
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.