

# CreateEventSource
<a name="API_CreateEventSource"></a>

Creates an EventSource, which forwards events from an origin (an AWS service or another account) onto an event bus. The bus must be ACTIVE. Retries carrying the same ClientToken are idempotent.

## Request Parameters
<a name="API_CreateEventSource_RequestParameters"></a>

 ** ClientToken **   
Unique, case-sensitive identifier that ensures the idempotency of the request. The SDK generates one automatically when the field is omitted.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 64.  
Pattern: `[\u0021-\u007E]+`   
Required: No

 ** Configuration **   
Discriminated EventSource configuration. Exactly one variant must be set.  
Type: [EventSourceConfiguration](API_EventSourceConfiguration.md) object  
 **Note: **This object is a Union. Only one member of this object can be specified or returned.  
Required: Yes

 ** Description **   
Free-text description. Used by every resource type that has one: event buses, subscribers, and event sources.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 512.  
Pattern: `[^\u0000-\u001F\u007F-\u009F\u2028\u2029]*(?![\s\S]).*`   
Required: No

 ** EventBusArn **   
The Amazon Resource Name (ARN) that uniquely identifies an event bus.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 1011.  
Pattern: `arn:aws(-[a-z0-9]+)*:events:[a-z][a-z0-9]*(-[a-z0-9]+)*:([0-9]{12}):event-busv2\/[A-Za-z0-9][\.\-_A-Za-z0-9]{0,255}\/[a-z0-9]{25}`   
Required: Yes

 ** Name **   
EventSource name. First character alphanumeric; the rest may add '.', '-', '\_'. Names may not begin with the reserved "aws." prefix. The grammar matches the ARN local-name segment in EventSourceArn (event-sourcev2/<type>/<name>/<id>), mirroring EventBusName, so a name the ARN cannot represent cannot be created.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 256.  
Pattern: `(?!aws\.)[A-Za-z0-9][\.\-_A-Za-z0-9]*`   
Required: Yes

 ** Tags **   
Tags attached to a resource, as key-value pairs.  
Type: String to string map  
Map Entries: Minimum number of 0 items. Maximum number of 200 items.  
Key Length Constraints: Minimum length of 1. Maximum length of 128.  
Key Pattern: `\S([\s\S]*\S)?(?![\s\S]).*`   
Value Length Constraints: Minimum length of 0. Maximum length of 256.  
Value Pattern: `(\S([\s\S]*\S)?)?(?![\s\S]).*`   
Required: No

## Response Elements
<a name="API_CreateEventSource_ResponseElements"></a>

The following elements are returned by the service.

 ** CreationTime **   
The time the EventSource was created.  
Type: Timestamp

 ** EventBusArn **   
The Amazon Resource Name (ARN) that uniquely identifies an event bus.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 1011.  
Pattern: `arn:aws(-[a-z0-9]+)*:events:[a-z][a-z0-9]*(-[a-z0-9]+)*:([0-9]{12}):event-busv2\/[A-Za-z0-9][\.\-_A-Za-z0-9]{0,255}\/[a-z0-9]{25}` 

 ** EventSourceArn **   
EventSource ARN: event-sourcev2/<type>/<name>/<id>. The type segment is set by the service (aws.service for AWS service events, aws.partner for partner events) and is not part of the resource's name. The id segment is a 25-character identifier generated by the service.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 1011.  
Pattern: `arn:aws(-[a-z0-9]+)*:events:[a-z][a-z0-9]*(-[a-z0-9]+)*:([0-9]{12}):event-sourcev2\/(aws\.service|aws\.partner)\/[A-Za-z0-9][\.\-_A-Za-z0-9]{0,255}\/[a-z0-9]{25}` 

 ** Name **   
EventSource name. First character alphanumeric; the rest may add '.', '-', '\_'. Names may not begin with the reserved "aws." prefix. The grammar matches the ARN local-name segment in EventSourceArn (event-sourcev2/<type>/<name>/<id>), mirroring EventBusName, so a name the ARN cannot represent cannot be created.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 256.  
Pattern: `(?!aws\.)[A-Za-z0-9][\.\-_A-Za-z0-9]*` 

 ** State **   
Lifecycle state of an EventSource. Revocation is reported by the Revoked flag.  
Type: String  
Valid Values: `CREATING | ACTIVE | UPDATING | CREATE_FAILED | UPDATE_FAILED | DELETING | DELETE_FAILED` 

## Errors
<a name="API_CreateEventSource_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
The caller does not have the permissions required to perform the operation. This error is also returned when the operation cannot use the AWS KMS key for the event bus.  
HTTP Status Code: 403

 ** ConcurrentModificationException **   
Another change to the resource is already in progress. Retry the request.  
HTTP Status Code: 409

 ** IdempotentParameterMismatchException **   
The request reuses the client token of an earlier request with different parameters. Use a new client token, or resend the earlier request unchanged.  
HTTP Status Code: 409

 ** InternalException **   
The request failed because of an internal service error. Retry the request.  
HTTP Status Code: 500

 ** InvalidInputException **   
A request parameter is missing or not valid.  
HTTP Status Code: 400

 ** InvalidStateException **   
The resource is not in a state that allows the operation. For example, an event bus that is still being created cannot accept events.  
HTTP Status Code: 409

 ** LimitExceededException **   
The request would exceed a service quota for the account.  
HTTP Status Code: 400

 ** ResourceAlreadyExistsException **   
A resource with the same name already exists.  
HTTP Status Code: 409

 ** ResourceNotFoundException **   
The resource does not exist.  
HTTP Status Code: 404

 ** ThrottlingException **   
The request was throttled because it exceeds a request rate limit. Retry the request with backoff.  
HTTP Status Code: 429

## See Also
<a name="API_CreateEventSource_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/eventbridgev2-2025-05-15/CreateEventSource) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/eventbridgev2-2025-05-15/CreateEventSource) 
+  [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/eventbridgev2-2025-05-15/CreateEventSource) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/eventbridgev2-2025-05-15/CreateEventSource) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/eventbridgev2-2025-05-15/CreateEventSource) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/eventbridgev2-2025-05-15/CreateEventSource) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/eventbridgev2-2025-05-15/CreateEventSource) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/eventbridgev2-2025-05-15/CreateEventSource) 
+  [AWS SDK for Python (Boto3)](https://docs.aws.amazon.com/goto/boto3/eventbridgev2-2025-05-15/CreateEventSource) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/eventbridgev2-2025-05-15/CreateEventSource) 