亚马逊 AWS Java API。我看不到我的 AMI
我正在使用适用于 Amazon AWS 的 Java API。我成功进行了身份验证,然后获取了所有图像,但我的图像不在其中(我的 AMI 是私有的,但我想由于我已通过身份验证,我仍然会看到它们)。这是我的来源...
final AmazonEC2 client = new AmazonEC2Client(credentails);
for(Image image: client.describeImages().getImages()){
if(image.getOwnerId().equals("1234567890")){
//... do something usefull with the AMI
}
}
并且我的“OwnerId”不在收到的内容中。有什么问题吗?我不会公开我的 AMI,我怎样才能获得我的 AMI?
回答:我位于错误的区域,并且我只从该区域获得 AMI,而不是我的。 更改区域的方法是:
client.setEndpoint("ec2.us-west-1.amazonaws.com");
I'm using the Java API for Amazon AWS. I successfully authenticate, then get all images and my images are not among them (my AMIs are private, but I suppose that I will still see them since I have been authenticated). Here is my source...
final AmazonEC2 client = new AmazonEC2Client(credentails);
for(Image image: client.describeImages().getImages()){
if(image.getOwnerId().equals("1234567890")){
//... do something usefull with the AMI
}
}
And my "OwnerId" is not among the received ones. What is the problem, I won't make my AMIs public, how can I get my AMIs?
ANSWER: I was in a wrong region, and I was getting only AMIs from that region, not mine.
The way to change region is:
client.setEndpoint("ec2.us-west-1.amazonaws.com");
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
仅供参考,如果您只对自己的实例感兴趣,您可以使用以下方法显着减少 DealInstances 调用中使用的带宽量:
FYI, if you're only interested in your own instances you can dramatically reduce the amount of bandwidth used in a DescribeInstances call using: