Publish EventBridge Event

Action ID: aws:eventbridge:event
NPM Package:

@aws/aws-core-plugin-for-backstage-scaffolder-actions

Description

Posts an AWS EventBridge event matching the provided details.

Input Schema

PropertyTypeDescriptionRequired
accountIdstringThe AWS account ID to create the resource.
regionstringThe AWS region to create the resource.
sourcestringThe source of the event.
detailstringA valid JSON object.
detailTypestringFree-form string, with a maximum of 128 characters, used to decide what fields to expect in the event detail.
eventBusNamestringThe name or ARN of the event bus to receive the event.

Output Schema

No output schema defined for this action.

Usage Examples

Notify when scaffolding starts on the default event bus

Post a start event to the default EventBridge bus after the fetch:template step starts a new service scaffolding run. Use this to trigger downstream automation like ticket updates or audit logging.

Copy
steps:
  - id: fetch-skeleton
    action: fetch:template
    input:
      url: https://github.com/acme/platform-templates/react-service/archive/main.zip
      targetPath: ./workspace
      values:
        name: ${{ parameters.name }}
        owner: ${{ parameters.owner }}
        description: ${{ parameters.description }}

  - id: emit-scaffold-start
    action: aws:eventbridge:event
    input:
      source: backstage.scaffolder
      detailType: ScaffolderRunStarted
      eventBusName: default
      detail: |
        {
          "serviceName": "${{ parameters.name }}",
          "owner": "${{ parameters.owner }}",
          "environment": "${{ parameters.environment }}",
          "action": "start",
          "template": "react-service"
        }

Send repository created event to a named bus in a specific region and account

After publishing the repository with publish:github, send an event to a named bus in a specific AWS account and region. Use this to notify central systems that a new repo exists.

Copy
steps:
  - id: fetch-app
    action: fetch:template
    input:
      url: https://github.com/acme/platform-templates/node-service/archive/main.zip
      targetPath: ./workspace
      values:
        name: ${{ parameters.name }}
        owner: ${{ parameters.owner }}

  - id: publish-repo
    action: publish:github
    input:
      repoUrl: github.com?owner=acme-apps&repo=${{ parameters.name }}
      defaultBranch: main
      description: ${{ parameters.description }}

  - id: emit-repo-created
    action: aws:eventbridge:event
    input:
      accountId: "123456789012"
      region: us-east-1
      source: backstage.scaffolder
      detailType: RepositoryCreated
      eventBusName: org-apps
      detail: |
        {
          "repository": "acme-apps/${{ parameters.name }}",
          "branch": "main",
          "scaffolderUser": "${{ parameters.owner }}",
          "remoteUrl": "${{ steps['publish-repo'].output.remoteUrl }}",
          "componentRef": "component:default/${{ parameters.name }}"
        }

Emit a cross account event using an event bus ARN

Send an event to a central platform account by targeting the bus ARN. This is useful when the scaffolder runs in a different AWS account from the event consumers.

Copy
steps:
  - id: fetch-template
    action: fetch:template
    input:
      url: https://github.com/acme/platform-templates/go-service/archive/main.zip
      targetPath: ./workspace
      values:
        name: ${{ parameters.name }}
        owner: ${{ parameters.owner }}

  - id: emit-cross-account
    action: aws:eventbridge:event
    input:
      source: backstage.scaffolder
      detailType: ServiceProvisionRequested
      eventBusName: arn:aws:events:us-west-2:210987654321:event-bus/platform-events
      detail: |
        {
          "name": "${{ parameters.name }}",
          "owner": "${{ parameters.owner }}",
          "language": "go",
          "regionHint": "us-west-2"
        }

Post component registration event after catalog registration

After registering the component in the catalog with catalog:register, emit an event for consumers that track catalog changes.

Copy
steps:
  - id: fetch-template
    action: fetch:template
    input:
      url: https://github.com/acme/platform-templates/python-service/archive/main.zip
      targetPath: ./workspace
      values:
        name: ${{ parameters.name }}
        owner: ${{ parameters.owner }}

  - id: publish-repo
    action: publish:github
    input:
      repoUrl: github.com?owner=acme-services&repo=${{ parameters.name }}
      defaultBranch: main
      description: ${{ parameters.description }}

  - id: register-catalog
    action: catalog:register
    input:
      repoContentsUrl: ${{ steps['publish-repo'].output.repoContentsUrl }}
      catalogInfoPath: /catalog-info.yaml

  - id: emit-registered
    action: aws:eventbridge:event
    input:
      source: backstage.scaffolder
      detailType: ComponentRegistered
      eventBusName: platform-events
      detail: |
        {
          "entityRef": "component:default/${{ parameters.name }}",
          "repo": "acme-services/${{ parameters.name }}",
          "catalogInfoPath": "/catalog-info.yaml",
          "registration": "completed"
        }

Parameterize bus and detail type per environment

Select the event bus and detail type from template parameters and target a regional bus. Use this when different environments route to different buses.

Copy
steps:
  - id: fetch-api
    action: fetch:template
    input:
      url: https://github.com/acme/platform-templates/express-api/archive/main.zip
      targetPath: ./workspace
      values:
        name: ${{ parameters.name }}
        owner: ${{ parameters.owner }}
        environment: ${{ parameters.environment }}

  - id: emit-env-specific
    action: aws:eventbridge:event
    input:
      accountId: "555566667777"
      region: ap-southeast-2
      source: acme.platform.scaffolder
      detailType: ${{ parameters.detailType }}
      eventBusName: ${{ parameters.eventBusName }}
      detail: |
        {
          "service": "${{ parameters.name }}",
          "environment": "${{ parameters.environment }}",
          "owner": "${{ parameters.owner }}",
          "status": "provisioned"
        }