# AppSyncTarget

Defines an AppSync Graphql API as the alias target.

Requires that the domain
name will be defined through `GraphqlApiProps.domainName`.

Implements: [IAliasRecordTarget](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_route53.IAliasRecordTarget.html)

- Source: [`aws-route53-targets/lib/appsync-target.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-route53-targets/lib/appsync-target.ts#L14)
- Type last changed: v2.172.0 · 7 Dec 2024

## Example

TypeScript:

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

declare const zone: route53.HostedZone;
declare const graphqlApi: appsync.GraphqlApi;

new route53.ARecord(this, 'AliasRecord', {
  zone,
  target: route53.RecordTarget.fromAlias(new targets.AppSyncTarget(graphqlApi)),
});
```

Python:

```python
import aws_cdk.aws_appsync as appsync

# zone: route53.HostedZone
# graphql_api: appsync.GraphqlApi

route53.ARecord(self, "AliasRecord",
    zone=zone,
    target=route53.RecordTarget.from_alias(targets.AppSyncTarget(graphql_api))
)
```

Java:

```java
import software.amazon.awscdk.services.appsync.*;

HostedZone zone;
GraphqlApi graphqlApi;

ARecord.Builder.create(this, "AliasRecord")
        .zone(zone)
        .target(RecordTarget.fromAlias(new AppSyncTarget(graphqlApi)))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.AppSync;

HostedZone zone;
GraphqlApi graphqlApi;

new ARecord(this, "AliasRecord", new ARecordProps {
    Zone = zone,
    Target = RecordTarget.FromAlias(new AppSyncTarget(graphqlApi))
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import appsync "github.com/aws/aws-cdk-go/awscdk"

var zone HostedZone
var graphqlApi GraphqlApi

route53.NewARecord(this, jsii.String("AliasRecord"), &ARecordProps{
	Zone: Zone,
	Target: route53.RecordTarget_FromAlias(targets.NewAppSyncTarget(graphqlApi)),
})
```

## Initializer

TypeScript:

```ts
new AppSyncTarget(graphqlApi: GraphqlApi)
```

Python:

```python
AppSyncTarget(graphql_api: GraphqlApi)
```

Java:

```java
new AppSyncTarget(GraphqlApi graphqlApi)
```

C# / .NET:

```csharp
new AppSyncTarget(GraphqlApi graphqlApi)
```

Golang:

```go
NewAppSyncTarget(GraphqlApi GraphqlApi)
```

## Methods

- `bind(_record: IRecordSet, _zone?: IHostedZone): AliasRecordTargetConfig` — Return hosted zone ID and DNS name, usable for Route53 alias targets.
