API Destination End Point
Identify App URL
Open the AWS Management Console for Cloud formation. You can find the API URL for this challenge in the Outputs of the CloudFormation Stack with a name containing ApiUrl.
Configure the EventBridge API Destination with basic auth security.
Open the AWS Management Console for Event Bridge.
On the EventBridge homepage, select API destinations from the left navigation.
On the API destinations page, select Create API destination.
On the Create API destination page
Enter api-destination as the Name
Enter the API URL identified in Step 1 as the API destination endpoint
Select POST as the HTTP method
Select Create a new connection for the Connection
Enter basic-auth-connection as the Connection name
Select Basic (Username/Password) as the Authorization type
Enter your userName
Enter your Password
- Click "Create" Button.
Configure an EventBridge rule to target the EventBridge API Destination
From the left-hand menu, select Rules.
From the Event bus dropdown, select the Orders event bus.
Click Create rule.
On the Define rule detail page
Enter OrdersEventsRule as the Name of the rule
Enter Send com.aws.orders source events to API Destination for Description
- Under Build event pattern
Choose Other for your Event source
Copy and paste the following into the Event pattern, and select Next to specify your target:
{ "source": [ "com.aws.orders" ] }
- Select your rule target:
Select EventBridge API destination as the target type.
Select api-destination from the list of existing API destinations.
- Click Next and finish walking through the rest of the walk-through to create the rule.
Send test Orders event
Using the Event Generator, send the following Order Notification events from the source com.aws.orders:
{ "category": "lab-supplies", "value": 415, "location": "us-east" }
Verify API Destination
If the event sent to the Orders event bus matches the pattern in your rule, then the event will be sent to an API Gateway REST API endpoint.
Select the Log group with an API-Gateway-Execution-Logs prefix.
Select the Log stream.
Toggle the log event to verify the basic authorization was successful.
And hereby you have successfully created your first custom event(API Gateway).