我使用这种URI来远程停止我的实例:
.to("aws-ec2://stopInstances?operation=stopInstances" +
"&accessKey=" + accessKey +
"&secretKey=" + secretKey)
secretKey包含+
符号。我found我应该对+
符号进行编码,因为它被视为space
。尝试w /和w / o编码仍然得到:
AWS was not able to validate the provided access credentials (Service: AmazonEC2; Status Code: 401; Error Code: AuthFailure; Request ID: XXXXX)
有人有什么建议吗?
重要客户端和服务器上的日期均为NTP同步。
答案 0 :(得分:0)
通过使用解决:
...
.to("aws-ec2://stopInstances?operation=stopInstances&amazonEc2Client=#ec2Client")
...
和
AmazonEC2Client amazonEC2Client = new AmazonEC2Client(new BasicAWSCredentials(accessKey, secretKey));
amazonEC2Client.setEndpoint("ec2.us-east-1.amazonaws.com");
main.bind("ec2Client", amazonEC2Client);