title: How to use AWS CDK to look up existing ApiGateway
body: <p>I am using AWS CDK to build my lambda, and I would like to register endpoints from the lambda's CDK stack.</p>
  <p>I found I can get an existing ApiGateway construct using fromRestApiId(scope, id, restApiId)
  (<a href="https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-apigateway.RestApi.html#static-fromwbrrestwbrapiwbrattributesscope-id-attrsspan-classapi-icon-api-icon-experimental-titlethis-api-element-is-experimental-it-may-change-without-noticespan" rel="nofollow noreferrer">documentation here</a>)</p>
  <p>So currently this works well:</p>
  <pre><code>    //TODO how to look up by ARN instead of restApiId and rootResourceId??
      const lambdaApi = apiGateway.LambdaRestApi
                                  .fromRestApiAttributes(this, generateConstructName(&quot;api-gateway&quot;), {
                                      restApiId: &lt;API_GATEWAY_ID&gt;,
                                      rootResourceId: &lt;API_GATEWAY_ROOT_RESOURCE_ID&gt;,
                                  });
  
      const lambdaApiIntegration = new apiGateway.LambdaIntegration(lambdaFunction,{
          proxy: true,
          allowTestInvoke: true,
      })
  
      const root = lambdaApi.root;
  
      root.resourceForPath(&quot;/v1/meeting/health&quot;)
          .addMethod(&quot;GET&quot;, lambdaApiIntegration);
  </code></pre>
  <p>But I would like to deploy to many AWS accounts, and many regions. I don't want to have to hardcode the <strong>API_GATEWAY_ID</strong> or <strong>API_GATEWAY_ROOT_RESOURCE_ID</strong> for each account-region pair.</p>
  <p>Is there a more generic way to get the existing ApiGateway construct, (e.g. by name or ARN)?</p>
  <p>Thank you in advance.</p>