3

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");
1
  • How to set the Endpoint with C# .NET SDK ? It seems that method is missing ? Jan 21, 2012 at 0:26

1 Answer 1

5

FYI, if you're only interested in your own instances you can dramatically reduce the amount of bandwidth used in a DescribeInstances call using:

DescribeImagesRequest request = new DescribeImagesRequest();
request.withOwners("self");

Collection<Image> images = client.describeImages(request).getImages();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.