aws-cdk-lib.aws_appsync.SchemaProps

interface SchemaProps

LanguageType name
.NETAmazon.CDK.AWS.AppSync.SchemaProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsappsync#SchemaProps
Javasoftware.amazon.awscdk.services.appsync.SchemaProps
Pythonaws_cdk.aws_appsync.SchemaProps
TypeScript (source)aws-cdk-lib » aws_appsync » SchemaProps

The options for configuring a schema from an existing file.

Example

import * as acm from 'aws-cdk-lib/aws-certificatemanager';
import * as route53 from 'aws-cdk-lib/aws-route53';

const myDomainName = 'api.example.com';
const certificate = new acm.Certificate(this, 'cert', { domainName: myDomainName });
const schema = new appsync.SchemaFile({ filePath: 'mySchemaFile' })
const api = new appsync.GraphqlApi(this, 'api', {
  name: 'myApi',
  schema,
  domainName: {
    certificate,
    domainName: myDomainName,
  },
});

// hosted zone and route53 features
declare const hostedZoneId: string;
declare const zoneName = 'example.com';

// hosted zone for adding appsync domain
const zone = route53.HostedZone.fromHostedZoneAttributes(this, `HostedZone`, {
  hostedZoneId,
  zoneName,
});

// create a cname to the appsync domain. will map to something like xxxx.cloudfront.net
new route53.CnameRecord(this, `CnameApiRecord`, {
  recordName: 'api',
  zone,
  domainName: api.appSyncDomainName,
});

Properties

NameTypeDescription
filePathstringThe file path for the schema.

filePath

Type: string

The file path for the schema.

When this option is configured, then the schema will be generated from an existing file from disk.