在Amazon SQS上获取未经过身份验证的对等点的异常

从JAR本地运行以下代码时:

public static List<Message> getMessages(AmazonSQS sqs, String queueUrl) throws IOException {
    ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest(queueUrl).withWaitTimeSeconds(5);
    List<Message> messages = sqs.receiveMessage(receiveMessageRequest).getMessages();
    return messages;
}

它工作得很好。但是,当尝试在EC2实例上远程运行它时,我得到以下异常:

相关文章