Ahmed A
Ahmed A

Reputation: 3662

Sending AWS EC2 RestAPI using Postman returns error

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:

https://ec2.amazonaws.com/?Action=DescribeInstances&Version=2016-11-15&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ACCESSKEYEXAMPLE/20170913/us-west-1/ec2/aws4_request&X-Amz-Date=20170913T013055Z&X-Amz-SignedHeaders=content-type&X-Amz-Signature=amzsignaturesamplegenerated

When I sent the RestAPI by clicking on "Send", I get the following error response: Status : "401 Unauthorized" AuthFailureAWS 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.

Upvotes: 1

Views: 4200

Answers (2)

Marcin
Marcin

Reputation: 238847

Just to complement @chriscatfr answer, here is a screenshot how to set postman parameters to query for instances in us-east-1 region:

enter image description here

Upvotes: 0

chriscatfr
chriscatfr

Reputation: 2662

I just found the solution to the same issue. Your URL should be:

https://ec2.us-west-1.amazonaws.com/?Action=DescribeInstances&Version=2016-11-15

It didn't work until I added &Version=2016-11-15 and the region.

This AWS Documentation page says that Version is mandatory

Upvotes: 4

Related Questions