Menu
 

PutPermission

Running PutPermission permits the specified AWS account to put events to your account's default event bus. CloudWatch Events rules in your account are triggered by these events arriving to your default event bus.

For another account to send events to your account, that external account must have a CloudWatch Events rule with your account's default event bus as a target.

To enable multiple AWS accounts to put events to your default event bus, run PutPermission once for each of these accounts.

The permission policy on the default event bus cannot exceed 10KB in size.

Request Syntax

{
   "Action": "string",
   "Principal": "string",
   "StatementId": "string"
}

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

Action

The action that you are enabling the other account to perform. Currently, this must be events:PutEvents.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 64.

Pattern: events:[a-zA-Z]+

Required: Yes

Principal

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.

If you specify "*", avoid creating rules that may match undesirable events. To create more secure rules, make sure that the event pattern for each rule contains an account field with a specific account ID from which to receive events. Rules with an account field do not match any events sent from other accounts.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 12.

Pattern: (\d{12}|\*)

Required: Yes

StatementId

An identifier string for the external account that you are granting permissions to. If you later want to revoke the permission for this external account, specify this StatementId when you run RemovePermission.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 64.

Pattern: [a-zA-Z0-9-_]+

Required: Yes

Response Elements

If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.

Errors

For information about the errors that are common to all actions, see Common Errors.

InternalException

This exception occurs due to unexpected causes.

HTTP Status Code: 500

PolicyLengthExceededException

The event bus policy is too long. For more information, see the limits.

HTTP Status Code: 400

ResourceNotFoundException

An entity that you specified does not exist.

HTTP Status Code: 400

Example

The following example enables the current account to receive events from account 111122223333.

Sample Request

POST / HTTP/1.1
Host: events.<region>.<domain>
x-amz-Date: <Date>
Authorization: AWS4-HMAC-SHA256 Credential=<Credential>, SignedHeaders=content-type;date;host;user-agent;x-amz-date;x-amz-target;x-amzn-requestid, Signature=<Signature>
User-Agent: <UserAgentString>
Content-Type: application/x-amz-json-1.1
Content-Length: <PayloadSizeBytes>
Connection: Keep-Alive 
X-Amz-Target: AWSEvents.PutPermission

{
   "Action":"events:PutEvents"
   "Principal":"111122223333"
   "StatementId":"MyStatement"
 
}

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: