Skip to Content
Aperture

Inbound triggers

Start a job from AWS EventBridge, SNS, or any HTTP client with a per-job URL and token.

An inbound trigger is an HTTP endpoint that starts a run of one job. Use it to react to events from other systems without giving them an Aperture account.

There are two types:

TypeForToken goes in
genericEventBridge API destinations, webhooks from other services, curl, other jobsX-Aperture-Trigger-Token header
snsAn Amazon SNS HTTPS subscription?token= query parameter

Triggers are managed from the CLI or the API; the dashboard doesn't have a triggers screen yet. Any team member can manage them.

Create a trigger

aperture-cli triggers create nightly-report name=on-demand
URL: https://aperture-server.mountaindev.com/api/v1/triggers/3b0e…
Header: X-Aperture-Trigger-Token: trg_…
Store the token now: it is not shown again.

Names are 1 to 100 characters and unique per job.

Fire a generic trigger

curl -X POST "https://aperture-server.mountaindev.com/api/v1/triggers/<trigger-id>" \
  -H "X-Aperture-Trigger-Token: trg_…" \
  -H "Content-Type: application/json" \
  -d '{"reportId": 42}'
{ "execution_id": "9f1c…" }
  • Any body and content type is accepted, up to 100 KiB. The job receives the raw body in APERTURE_TRIGGER_PAYLOAD.
  • The response is 202 once the run is queued, not when it finishes.
  • From Node, use fireApertureTrigger.

EventBridge

Create an EventBridge API destination pointing at the trigger URL, with a connection that sends the X-Aperture-Trigger-Token header (API key authorization). EventBridge events are deduplicated: if the same event id arrives again within 10 minutes, no new run starts and the response includes "duplicate": true.

SNS triggers

aperture-cli triggers create nightly-report name=budgets type=sns \
  topic_arn=arn:aws:sns:us-east-1:123456789012:budget-alerts

The CLI prints a subscription URL that already includes the token. Create an HTTPS subscription on the topic with that URL. Aperture:

  • confirms the subscription automatically (no run starts),
  • verifies every message's SNS signature and that it comes from the configured topic,
  • starts a run for each Notification, with the SNS Message in APERTURE_TRIGGER_PAYLOAD and the subject, message ID and topic in APERTURE_TRIGGER_SNS_* variables,
  • ignores repeated deliveries of the same MessageId within 10 minutes.

Rotate, disable and delete

aperture-cli triggers rotate nightly-report <trigger-id>    # new token; the old one stops working
aperture-cli triggers disable nightly-report <trigger-id>   # calls now return 404
aperture-cli triggers enable nightly-report <trigger-id>
aperture-cli triggers delete nightly-report <trigger-id>

Responses

StatusBodyMeaning
202{"execution_id": "…"}Run queued. Adds "duplicate": true for a deduplicated event.
200{"status": "subscription_confirmed"}SNS subscription confirmed.
400{"error": "Not a valid SNS message."}SNS trigger received something that isn't an SNS message.
401{"error": "Invalid trigger token."}Wrong or missing token, or an invalid SNS signature.
402{"error": "quota_exceeded", …}The team is out of execution minutes. See Billing.
403{"error": "Topic not allowed for this trigger."}SNS message from a different topic.
404{"error": "Not Found"}Unknown or disabled trigger.
413{"error": "Payload exceeds 102400 bytes."}Body over 100 KiB.

Reading the payload in your job

import { requireApertureTrigger } from '@acruxdynamics/aperture';

const trigger = requireApertureTrigger();
const body = trigger.json<{ reportId: number }>();

See Writing jobs for the variables.

On this page