# AppSync

Use an AppSync GraphQL API as a target for Amazon EventBridge rules.

Extends: AppSync
Implements: IRuleTarget

- Source: [`aws-events-targets/lib/appsync.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-events-targets/lib/appsync.ts#L38)
- Type last changed: v2.235.0 · 15 Jan 2026

## Example

```ts
import * as appsync from 'aws-cdk-lib/aws-appsync';

const api = new appsync.GraphqlApi(this, 'api', {
  name: 'api',
  definition: appsync.Definition.fromFile('schema.graphql'),
  authorizationConfig: {
    defaultAuthorization: { authorizationType: appsync.AuthorizationType.IAM }
  },
});

const rule = new events.Rule(this, 'Rule', {
  schedule: events.Schedule.rate(cdk.Duration.hours(1)),
});

rule.addTarget(new targets.AppSync(api, {
  graphQLOperation: 'mutation Publish($message: String!){ publish(message: $message) { message } }',
  variables: events.RuleTargetInput.fromObject({
    message: 'hello world',
  }),
}));
```

## Initializer

```ts
new AppSync(appsyncApi: IGraphqlApi, props: AppSyncGraphQLApiProps)
```

## Methods

- `bind(rule: IRuleRef, _id?: string): RuleTargetConfig` — Returns a RuleTarget that can be used to trigger this AppSync GraphQL API as a result from an EventBridge event.
