samedi 12 avril 2014

c# - liste de AWS EC2 image vide - Stack Overflow


I created an AMI using the AWS management console. Now I wanted to use AWS SDK for .NET using Visual Studio 2010 to launch an EC2 instance using the AMI image I created. I am able to get the security group and key pair I created but when I try to get image list using DescribeImagesRequest and Response with filter as owner-id, I get an empty list. Please help as to why I can not see any of the images that I created. I have used the same region for the security group, key pair and the image


        var ownerId = "xxxxxxxxxx";
DescribeImagesRequest imagesRequest = new DescribeImagesRequest();
Filter ownerFilter = new Filter();
ownerFilter.Name = "owner-id";
List<String> filterValues = new List<string>();
filterValues.Add(ownerId);
ownerFilter.Values = filterValues;
List<Filter> filters = new List<Filter>();
filters.Add(ownerFilter);
imagesRequest.Filters = filters;

System.Console.WriteLine("Image request created");
DescribeImagesResponse imagesResponse = ec2Client.DescribeImages(imagesRequest);
System.Console.WriteLine("Image response received");

List<Amazon.EC2.Model.Image> images = imagesResponse.Images;
System.Console.WriteLine("The total number of images are : " + images.Count);

The images.Count is empty and its not getting any images though I can see the images listed on the AWS management console.




I had the same issue but using the "owner-alias" filter. I wanted to use "self" to get all my AMIs. Instead of using the filter I'm using the "Owners" property which is working with the "self" alias.


DescribeImagesRequest imagesRequest = new DescribeImagesRequest();
imagesRequest.Owners.Add("self");
DescribeImagesResponse imagesResponse = ec2Client.DescribeImages(imagesRequest);


I created an AMI using the AWS management console. Now I wanted to use AWS SDK for .NET using Visual Studio 2010 to launch an EC2 instance using the AMI image I created. I am able to get the security group and key pair I created but when I try to get image list using DescribeImagesRequest and Response with filter as owner-id, I get an empty list. Please help as to why I can not see any of the images that I created. I have used the same region for the security group, key pair and the image


        var ownerId = "xxxxxxxxxx";
DescribeImagesRequest imagesRequest = new DescribeImagesRequest();
Filter ownerFilter = new Filter();
ownerFilter.Name = "owner-id";
List<String> filterValues = new List<string>();
filterValues.Add(ownerId);
ownerFilter.Values = filterValues;
List<Filter> filters = new List<Filter>();
filters.Add(ownerFilter);
imagesRequest.Filters = filters;

System.Console.WriteLine("Image request created");
DescribeImagesResponse imagesResponse = ec2Client.DescribeImages(imagesRequest);
System.Console.WriteLine("Image response received");

List<Amazon.EC2.Model.Image> images = imagesResponse.Images;
System.Console.WriteLine("The total number of images are : " + images.Count);

The images.Count is empty and its not getting any images though I can see the images listed on the AWS management console.



I had the same issue but using the "owner-alias" filter. I wanted to use "self" to get all my AMIs. Instead of using the filter I'm using the "Owners" property which is working with the "self" alias.


DescribeImagesRequest imagesRequest = new DescribeImagesRequest();
imagesRequest.Owners.Add("self");
DescribeImagesResponse imagesResponse = ec2Client.DescribeImages(imagesRequest);

0 commentaires:

Enregistrer un commentaire