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.

APIURL

Configure the EventBridge API Destination with basic auth security.

  1. Open the AWS Management Console for Event Bridge.

  2. On the EventBridge homepage, select API destinations from the left navigation.

  3. On the API destinations page, select Create API destination.

    CreateAPIDestination

  4. 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

    CreateAPIDestinationConfig

  1. Click "Create" Button.

Configure an EventBridge rule to target the EventBridge API Destination

  1. From the left-hand menu, select Rules.

  2. From the Event bus dropdown, select the Orders event bus.

  3. Click Create rule.

  4. 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

  1. 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"
          ]
      }
    

    EBruletargetAPI1

  1. Select your rule target:
  • Select EventBridge API destination as the target type.

  • Select api-destination from the list of existing API destinations.

    EBruletargetAPI2

  1. 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.

  1. Open the AWS Management Console for Cloud Watch Log Group.

  2. Select the Log group with an API-Gateway-Execution-Logs prefix.

    VerifyApiDestination

  3. Select the Log stream.

    SelectAPILogStream

  4. Toggle the log event to verify the basic authorization was successful.

    APILogEvent

And hereby you have successfully created your first custom event(API Gateway).