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개 답변
0
수락된 답변

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

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

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

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

관련 콘텐츠