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
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠