title: Getting AWS API Gateway Request Id in backend api
body: <p>We have setup of apis as below</p>
  
  <pre><code>Development : ASP NET Core 2.1 C#
  Backend api deployment : In AWS through docker
  Gateway : AWS API Gateway which contains custom lambda Authorizer
  </code></pre>
  
  <p>Requirement : To get the API Gateway request id in backend api for logging and request tracking.</p>
  
  <p>As the request passes through the API gateway, it generates a request id. This is set in response header in "<strong>x-amzn-RequestId</strong>" by the gateway and can be visible in client (like postman). I could find that this id is also available in the lambda authorizer in the object of <strong>APIGatewayCustomAuthorizerRequest</strong> - .<strong>RequestContext.RequestId</strong>, which I could use for the authorizer logging.</p>
  
  <p>Now as the request is authorized, actual api is invoked. I want the same request id in this api for logging purpose. Eventually - to identify the journey of request through the gateway-aurhorizer-api having same request  and generate the stats.</p>
  
  <p>In the api code, we have also implemented <strong>OnActionExecuting()</strong> of <strong>APIControllerActionFilter</strong>. I want to know if the gateway request id is available here by any means ? Or any way to pass the id from the gateway to the actual api ? </p>