I am trying to send a EC2 RestAPI (DescribeInstances) using Postman application. I created a user in IAM in AWS. I generated a AccessKeyId and SecretKey for that particular user, and gave the user "AmazonEC2FullAccess" policy (all EC2 access). I used the following steps in Postman to send the ResAPI:
- "Get" operation, set End Point to https://ec2.amazonaws.com/?Action=DescribeInstances
In the "Authorization" Tab, selected "AWS Signature" and set the following fields:
- AccessKey = ACCESSKEYEXAMPLE
- SecretKey = SECRETKEYEXAMPLE
- AWS Region = us-west-1
- Service Name = ec2
Click on "Update Request", which ends up generating 3 Headers. I used the info from the generated Headers to modify the endpoint as follows:
- "Content-Type" header is set to "application/x-www-form-urlencoded", and deleted X-Amz-Date and Authorization headers.
When I sent the RestAPI by clicking on "Send", I get the following error response:
Status : "401 Unauthorized"
AuthFailure
AWS was not able to validate the provided access credentials4bc49d04-2115-4b95-8af5-5ac879ac5df3
The error seems to suggest a malformed RestAPI as opposed to an unauthorized access. Tried different variations, very confused. Any help would be highly appreciated.
Thank you, Ahmed.
ec2.amazonaws.com
is not the endpoint for us-west-1. The correct hostname isec2.us-west-1.amazonaws.com
. – Michael - sqlbotGET
request, the browser would not normally set aContent-Type
header, as it would with aPOST
. – Michael - sqlbot