如何使用AWS API在请求中传递访问凭证 [英] How to pass access credentials in request with AWS API

查看:182
本文介绍了如何使用AWS API在请求中传递访问凭证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用AWS API传递请求,但出现此错误

I'm trying to pass a request with AWS API but I get this error

AWS was not able to validate the provided access credentials

我的要求是:

https://ec2.amazonaws.com/?Action=RunInstances&ImageId=ami-6df1e514&KeyName=key1&InstanceType=t2.micro&Placement.AvailabilityZone=us-west-2&AWSSecretAccessKey=**********************&AWSAccessKeyId=******************

我的访问凭据是正确的,对此毫无疑问. 我发现问题可能是由时钟延迟引起的,但是我的电脑的时钟是正确的. 有人可以帮我,我没有找到解决方法.

My access credentials are right, there is no doubt about that. I found that the problem could be caused by clock delay but My PC's clock is correct. Could someone help me, I did not find a solution.

推荐答案

从不在进行API调用时将您的秘密访问密钥发送到AWS.而是使用访问/秘密密钥对请求进行签名(如此处上阅读有关签名的更多信息.

You never send your secret access key to AWS when making an API call. Instead, you sign your request with the access/secret keys (as described here). You can read more about signing here.

理想情况下,请使用 JavaScript SDK ,而不要手动生成查询请求.

Ideally, use the JavaScript SDK rather than manually generating query requests.

您还应该旋转您使用的凭据,因为您已经公开了密钥.

You should also rotate the credentials that you were using because you have exposed the secret key.

这篇关于如何使用AWS API在请求中传递访问凭证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆