This pattern creates an HTTP API endpoint that directly integrates with Amazon EventBridge
Learn more about this pattern at Serverless Land Patterns: https://serverlessland.com/patterns/apigateway-http-eventbridge-cdk
Important: this application uses various AWS services and there are costs associated with these services after the Free Tier usage - please see the AWS Pricing page for details. You are responsible for any AWS costs incurred. No warranty is implied in this example.
- Create an AWS account if you do not already have one and log in. The IAM user that you use must have sufficient permissions to make necessary AWS service calls and manage AWS resources.
- AWS CLI installed and configured
- Git Installed
- Node and NPM installed
- AWS Cloud Development Kit (AWS CDK) installed
-
Clone the project to your local working directory
git clone https://github.com/aws-samples/serverless-patterns
-
Change the working directory to this pattern's directory
cd apigw-http-api-eventbridge-cdk/cdk
-
Install dependencies
npm install
-
Deploy the stack to your default AWS account and region. The output of this command should give you the HTTP API URL.
cdk deploy
This pattern creates an Amazon API gateway HTTP API endpoint. The endpoint uses service integrations to directly connect to Amazon EventBridge. An EventBridge rule sends all events to Cloudwatch Logs.
To test the endpoint first send data using the following command. Be sure to update the endpoint with endpoint of your stack.
curl --location --request POST '<your api endpoint>' --header 'Content-Type: application/json' \
--data-raw '{
"Detail":{
"message": "This is my test"
}
}'
Then check the logs in Cloudwatch logs
Run the given command to delete the resources that were created. It might take some time for the CloudFormation stack to get deleted.
cdk destroy
Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0