How can I create a signed GET curl request using aws cli?

0

I'm trying to do something I thought was easy, but my google fu is failing me. I have been provided an API gateway endpoint that I must call a get on the d/l a file onto my EC2 instance. The request has to be signed. I see all kinds of SDK's and examples, but nothing for cli. I don't see aws cli command that will let me call a gateway endpoint (test-invoke) doesn't seem right. Is there one.

If not, is there a simple way to use the aws cli to create a signed request that I can send with invoke-webrequest (powershell) to d/l the file.

The IAM permissions are in place and the EC2 instance profile does have the invoke permission for the API.

1 réponse
0
Réponse acceptée

AWS CLI does not provide an option to get signed request. Since you're making a HTTPS call to API gateway, using IAM user permissions, you need to use SigV4 to add authentication information to the request.

More info - https://docs.aws.amazon.com/general/latest/gr/create-signed-request.html

This page explains the steps required to sign the request. I can think of two options - (1) try to generate the signature in power shell by following the steps described on the link above, or (2) Write a function in language you prefer using one of the code sample (links provided on this page) to generate the signature and use powershell to invoke the same and send request using invoke-webrequest.

AWS
répondu il y a un an
  • Yea, kinda what I was trying to avoid. :)

  • I decided to create a lambda that will d/l the file and put it in s3 so my instance can download it from there using the AWS cli. Thanks for your suggestions.

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions