Issue
Let,s say, i have authorized "iam"-User in my region to access a resource path in my API.
My question is right now:
How can i test after enabling iam-authorization on my API using CURL ?
One of my resource path looks like following:
https://my-api-id.execute-api.eu-central-1.amazonaws.com/dev/music/{id}
Solution
Firstly get control access to API gateway using your IAM user permissions by attaching the required policies. More info here
Then get your credentials for that IAM user by clicking on My Security Credentials
from the dropdown menu located upper right.
curl -X GET \
'https://my-api-id.execute-api.AWS_REGION.amazonaws.com/dev/music/{id}' \
-H 'Authorization: AWS4-HMAC-SHA256 Credential=YOUR_ACCESS_KEY/20210902/us-east-1/execute-api/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature=b28388012a84499650cf766bed595b51a8de988da0874140af78bd1775b95bb9' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'X-Amz-Date: 20210902T055703Z'
This will be your CURL request but you have to create the signature string first see here
Answered By - Harshit Rastogi Answer Checked By - Robin (WPSolving Admin)