Skip to content

Data Source: awsApiGatewayRestApi

Use this data source to get the id and root_resource_id of a REST API in API Gateway. To fetch the REST API you must provide a name to match against. As there is no unique name constraint on REST APIs this data source will error if there is more than one match.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.dataAwsApiGatewayRestApi.DataAwsApiGatewayRestApi(this, "my_rest_api", {
  name: "my-rest-api",
});

Argument Reference

  • name - (Required) Name of the REST API to look up. If no REST API is found with this name, an error will be returned. If multiple REST APIs are found with this name, an error will be returned.

Attributes Reference

  • apiKeySource - Source of the API key for requests.
  • arn - ARN of the REST API.
  • binaryMediaTypes - List of binary media types supported by the REST API.
  • description - Description of the REST API.
  • endpointConfiguration - The endpoint configuration of this RestApi showing the endpoint types of the API.
  • executionArn - Execution ARN part to be used in lambdaPermission's sourceArn when allowing API Gateway to invoke a Lambda function, e.g., arn:aws:executeApi:euWest2:123456789012:z4675Bid1J, which can be concatenated with allowed stage, method and resource path.
  • id - Set to the ID of the found REST API.
  • minimumCompressionSize - Minimum response size to compress for the REST API.
  • policy - JSON formatted policy document that controls access to the API Gateway.
  • rootResourceId - Set to the ID of the API Gateway Resource on the found REST API where the route matches '/'.
  • tags - Key-value map of resource tags.