Skip to content

EventBridge

An event bus and scheduler. In Byks, EventBridge triggers a Lambda function or an SQS queue on a schedule, and calls external HTTP endpoints on a schedule with optional authorization.

Configure recurring triggers for a Lambda function or an SQS queue on that resource. See the schedules option on the Lambda Function and SQS pages. scheduled_api_invocations, documented below, sets up EventBridge to call an external HTTP endpoint on a schedule.

Byks guides

Terraform configuration

scheduled_api_invocations sets up EventBridge to call an external HTTP endpoint on a schedule, with optional authorization.

main.tf
module "application" {
  source = "git@github.com:BYM-IKT/terraform-byks-module.git?ref=v12"
  # ...

  scheduled_api_invocations = {
    # options go here
  }
}

Options

Option Type Default Description
authorizers map(object) required Named authorization configurations that schedules reference by key. See Schedule authorizer object.
schedules map(object) required EventBridge schedules that call an external HTTP endpoint. The map key is an arbitrary identifier for the schedule. See Schedule object.

Schedule authorizer object

Used in authorizers. The map key is an arbitrary identifier that a schedule's authorizer_id references.

Option Type Default Description
description string null Description of the authorizer.
basic object null HTTP Basic authentication credentials. Set exactly one of basic, api_key, or oauth. See Basic auth object.
api_key object null An API key sent as a request header. Set exactly one of basic, api_key, or oauth. See API key object.
oauth object null OAuth 2.0 client credentials flow, for example against OneLogin. Set exactly one of basic, api_key, or oauth. See OAuth object.
invocation_http_parameters list(object) null Extra HTTP parameters sent with the invocation request itself, separate from the token request in oauth. See HTTP parameter object.

Basic auth object

Used in authorizers.basic.

Option Type Default Description
username string required Basic auth username.
password string required Basic auth password.

API key object

Used in authorizers.api_key.

Option Type Default Description
header_name string required Name of the HTTP header the API key gets sent in.
value string required API key value.

OAuth object

Used in authorizers.oauth.

Option Type Default Description
authorization_endpoint string required Token endpoint the client credentials flow requests a token from, for example https://oslo.onelogin.com/oidc/2/token for OneLogin.
http_method string required HTTP method used for the token request.
client_id string required OAuth client ID.
client_secret string required OAuth client secret.
http_parameters list(object) required Parameters sent with the token request. See HTTP parameter object.

HTTP parameter object

Used in oauth.http_parameters and invocation_http_parameters.

Option Type Default Description
type string required Either BODY, HEADER, or QUERY_STRING.
key string required Parameter name.
value string required Parameter value.
is_value_secret bool false Mark value as sensitive.

Schedule object

Used in schedules. The map key is an arbitrary identifier for the schedule.

Option Type Default Description
http_method string required HTTP method used to call target_url.
target_url string required URL called on each scheduled invocation.
schedule_expression string required EventBridge schedule expression, for example rate(5 minutes) or cron(0 8 * * ? *).
body string null JSON-encoded request body, built with jsonencode(). AWS ignores it for GET, DELETE, HEAD, and OPTIONS requests.
authorizer_id string null Key of an entry in authorizers to sign the request with. Leave unset to call target_url without authorization.
description string null Description shown in the EventBridge console.
maximum_retry_attempts number 3 Number of retry attempts on failure. AWS's own default is 185 attempts, too many for BYM.
enabled bool true Turn the schedule on or off.

Resources