# ApiGateway

Defines an API Gateway REST API as the alias target. Requires that the domain name will be defined through `RestApiProps.domainName`.

You can direct the alias to any `apigateway.DomainName` resource through the
`ApiGatewayDomain` class.

Extends: ApiGatewayDomain › ApiGateway
Implements: IAliasRecordTarget

- Source: [`aws-route53-targets/lib/api-gateway-domain-name.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-route53-targets/lib/api-gateway-domain-name.ts#L30)

## Example

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

declare const api: apigateway.RestApi;
declare const hostedZoneForExampleCom: any;

new route53.ARecord(this, 'CustomDomainAliasRecord', {
  zone: hostedZoneForExampleCom,
  target: route53.RecordTarget.fromAlias(new targets.ApiGateway(api))
});
```

## Initializer

```ts
new ApiGateway(api: RestApiBase)
```

## Methods

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