How to SigV4 sign a request from API Gateway to AppSync using an HTTPIntegration?

0

I needed to set up cross account access to AppSync, from account A to account B. I'm using CDK for infra. Since AppSync doesn't support resource based policies, I created an instance of API gateway in account B, and setup a aws service integration (AwsIntegration) from the API Gateway to AppSync in that account; Then I set up a resource based policy on the API gateway in account B that allows requests from services in account A, which then get proxied to AppSync in account B. I got the approach from here.

Instead of using a aws service integration, I'd like to use the HttpIntegration. The HttpIntegration, however, doesn't seem to create the needed Authorization header to access AppSync. I keep getting 401 error when I try to test. Is the credentialsRole on the construct just being ignored? Or am I missing something?

Thanks

1回答
0

With HttpIntegration, the request is sent as normal web request, so you'll need to include sig v4 as described here - https://docs.aws.amazon.com/general/latest/gr/create-signed-request.html

If you are trying to proxy the request from API Gateway in account B, then the identity that's initiating the request must have access to the resource you're accessing and then generate the signature accordingly.

AWS
回答済み 1年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ