Skip to content
v2.274.0

AppSyncTarget Class ​

Defines an AppSync Graphql API as the alias target.

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

Example ​

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
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
import software.amazon.awscdk.services.appsync.*;

HostedZone zone;
GraphqlApi graphqlApi;


ARecord.Builder.create(this, "AliasRecord")
        .zone(zone)
        .target(RecordTarget.fromAlias(new AppSyncTarget(graphqlApi)))
        .build();
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))
});
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 ​

ts
new AppSyncTarget(graphqlApi: GraphqlApi)
python
AppSyncTarget(graphql_api: GraphqlApi)
java
new AppSyncTarget(GraphqlApi graphqlApi)
csharp
new AppSyncTarget(GraphqlApi graphqlApi)
go
NewAppSyncTarget(GraphqlApi GraphqlApi)

Methods ​

bind(_record: IRecordSet, _zone?: IHostedZone): AliasRecordTargetConfigdef bind(self, _record: IRecordSet, _zone: typing.Optional[IHostedZone] = None) -> AliasRecordTargetConfigpublic AliasRecordTargetConfig bind(IRecordSet _record, IHostedZone _zone)public AliasRecordTargetConfig Bind(IRecordSet _record, IHostedZone? _zone = null)func Bind(_record IRecordSet, _zone IHostedZone) AliasRecordTargetConfig#
Return hosted zone ID and DNS name, usable for Route53 alias targets.